Questions tagged [android-implicit-intent]

An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can and you'd like the user to pick which app to use.

From the official Android documentation :

An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can and you'd like the user to pick which app to use.

For example, if you have content you want the user to share with other people, create an intent with the ACTION_SEND action and add extras that specify the content to share. When you call startActivity() with that intent, the user can pick an app through which to share the content.

Caution: It's possible that a user won't have any apps that handle the implicit intent you send to startActivity(). If that happens, the call will fail and your app will crash. To verify that an activity will receive the intent, call resolveActivity() on your Intent object. If the result is non-null, then there is at least one app that can handle the intent and it's safe to call startActivity(). If the result is null, you should not use the intent and, if possible, you should disable the feature that issues the intent.

// Create the text message with a string
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // "text/plain" MIME type

// Verify that the intent will resolve to an activity
if (sendIntent.resolveActivity(getPackageManager()) != null) {
    startActivity(sendIntent);
}

Note: In this case, a URI is not used, but the intent's data type is declared to specify the content carried by the extras.

When startActivity() is called, the system examines all of the installed apps to determine which ones can handle this kind of intent (an intent with the ACTION_SEND action and that carries "text/plain" data). If there's only one app that can handle it, that app opens immediately and is given the intent. If multiple activities accept the intent, the system displays a dialog so the user can pick which app to use.

106 questions
5
votes
1 answer

How to show list of installed calendars in settings screen of android

I would like to display the list of installed calendars in android in the settings screen and select one among them. I saw this functionality in an android application Cal. Screenshot of the list of installed calendars in Cal app can be found…
5
votes
1 answer

Activity exported=false listed in activity chooser

I have two similar applications (one free, one paid). An activity is defined with exported="false"
4
votes
0 answers

Android: Receiving Implicit Intent from Twitter - Bundle null

I have been trying to receive a Tweet URL or Tweet ID in my android application by sharing a Tweet from Twitter and choosing my app from the chooser. I have setup an intent filter which successfully makes my app available when sharing a…
4
votes
1 answer

implicit intent for contact groups list

I want to pick group (Contact Group). I found code to open Contacts Activity but didn't found for Group. Intent intentContact = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivity(intentContact); Is there anyone…
4
votes
1 answer

Android, having trouble starting an activity implicitly

so my main problem is starting a new app with an implicit intent. So here is the activity that is supposed to start the nem app: package course.labs.permissionslab; public class GoToDangerousActivity extends Activity { private static final String…
4
votes
2 answers

Android service not starting with a warninig

I have a service that supposed to upload photos in the background. But when I try to start it, it doesn't start. In the logcat I've noticed that I get a warning Implicit intents with startService are not safe : Intent { .....}. I've already tripled…
RCB
  • 2,253
  • 2
  • 25
  • 49
3
votes
1 answer

Android implicit BroadcastReceiver with signature permission is not called in Android O

In my first application, I define a custom permission and an implicit BroadcastReceiver in manifest file:
3
votes
2 answers

send SMS Intent in Android

String x="Hello World"; String y="You Rock!!!"; Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", x); sendIntent.putExtra("sms_body", y);…
nubme
  • 2,857
  • 8
  • 29
  • 25
3
votes
2 answers

Why does the Main activity has an intent filter?

If the intent filters are to resolve implicit intents, then why does the MainActivity(which is the very first activity that is run when app is launched) has an intent filter? Who send an implicit intent to it? What if the sent implicit intent…
3
votes
1 answer

Android multi-fragment layout in landscape mode

Although I got my code to work, I now have no idea what it's actually doing. My app is an RSS reader, and the main content is in a Fragment containing a ListView with NewsStory objects. When a list item is clicked, it opens an Intent with the…
3
votes
1 answer

How to Show App's Name in "Completing action using" menu?

I tried to use implicit intent to open my android app. It almost works, my app icon really appears in the menu "completing action with". However, instead of showing the real app name, as all the other applications do, the name appeared below the…
streaver91
  • 864
  • 1
  • 8
  • 10
2
votes
0 answers

Android Studio : while email sending and running the app on phone the app is not detecting any other mail sending apps?

I am just a beginner in app dev and referring the documentation wanted to build an email sending app using Implicit Intents. this works well when we write Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("*/*"); but when we write the…
2
votes
2 answers

IntentBuilder(Context,ComponentName) has private access in IntentBuilder

The following is the error I get when I try running the application error: constructor IntentBuilder in class IntentBuilder cannot be applied to given types; new ShareCompat.IntentBuilder(context) ^ required:…
2
votes
3 answers

Can not resolve com.android.camera.action.CROP in android 11 for first time app is installed

I am starting implicit intent for crop with string "com.android.camera.action.CROP" on android 11. when application is first installed can not resolve its activity by this code. Intent intent = new Intent("com.android.camera.action.CROP"); …
2
votes
2 answers

Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent

I am getting below exception rarely while selecting video from gallery- Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent {…