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
1
vote
0 answers

Outlook email app not adding attachment

Have written simple implicit intent for opening email application. Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setType("*/*"); emailIntent.setData(Uri.parse("mailto:")); …
1
vote
1 answer

Allow other apps to start my activity when the user touches a download link

There is a feature in ADM (Download Manager) that if the user touches a download link (not a web page), the ADM(Download Manager) will be appeared as an application that has the ability to download files. What should I do that if the user touched a…
Hadi
  • 544
  • 1
  • 8
  • 28
1
vote
0 answers

Back button from implicit intent to activity that started it not the main activity

I have a main activity that has a button. Pressing the button opens a child activity. Inside the child activity is a button. Pressing that button opens an implicit intent (YouTube video). Here's my code in the child activity: startActivity(new…
Arash Fotouhi
  • 1,933
  • 2
  • 22
  • 43
1
vote
2 answers

What does it mean when two or more activities, each having intent-filter with action=android.intent.action.ACTION_MAIN?

Doc says https://developer.android.com/reference/android/content/Intent.html#ACTION_MAIN is an entry point. Example code:
sofs1
  • 3,834
  • 11
  • 51
  • 89
1
vote
1 answer

How to filter android file chooser apps

I am using below code to select the file from device Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("*/*"); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); startActivityForResult(intent,1212); The above code give below output Is…
1
vote
1 answer

"Error, could not load media" when attempting to call Photos app crop intent sending Uri that points to files dir

What I'm attempting to do: Select a photo from my Facebook photos and then send that photo to the native Photo editing experience (the Photos app) Here are the steps I'm taking: Get url for photo from fb Use Picasso to fetch image url into…
Karim Varela
  • 7,562
  • 10
  • 53
  • 78
1
vote
1 answer

implicit intent: shating images from gallery to my app

I'm trying to make the gallery app share images to my app, the problem is that I don't know how to get the image data sent to me by the gallery. I assumed that I may found the data in the method .getData() but it returns null this is my…
1
vote
1 answer

Implicit Intent with user-specified action

I'm experimenting, specifying my own action for use in an implicit intent. In a single package, I define two activities. ActivityTwo is to be called from onClick() in ActivityOne, using an implicit intent with an action…
1
vote
3 answers

Android: Choose the application with which to open a link

In Android applications, often the choice of selecting an app to open a link or do some other action is left to the user, i.e. the framework lets the user choose the app to do something. For example, say you have a link to a tweet, and you are…
1
vote
1 answer

Android:app creation malfunction(Implicit Intent)

I have two applications where the one opens by implicit intentthe other one.So in the first application I create an Intent and where I wrote i.setAction("com.example.secondApp");and I launch it through startActivity(i); Then on the second app I…
1
vote
1 answer

Get installed application details programatically for opening a pdf

I am working in an android application and I want all the app details in my android device by which I will be able to open my pdf. For example, by using implicit intent we will be able to see all the app name in a dialog by which we can select an…
1
vote
1 answer

How to get back to initial app where the implicit intent is started?

I have an app which contain some buttons.some of these buttons open specific URL/address by android internet browser and close my app(implicit intent). but i want this, when user close internet browser android redirect user to my app…
SDG69
  • 161
  • 1
  • 4
  • 19
1
vote
3 answers

Unable to attach file in android

I want to attach file in a mail....The thing is I want to use ACTION_SENDTO .When I send the mail without an attachment it works fine but when I try to attach a file it gives an exception (android.content.ActivityNotFoundException) just like the…
1
vote
1 answer

for loop not incrementing in Doinbackground in async task

Im reading image url from a Array list in doInBackground using for loop , but loop is not incrementing only 1st url is loading and saving image . here is code : class DownloadImageTask extends AsyncTask { // This class…
Bibi Tahira
  • 1,082
  • 5
  • 15
  • 39
1
vote
2 answers

Sending a SMS Message from an Android Application without opening chooser?

In my android application I have implemented sending SMS by using below code. Intent smsIntent = new Intent(Intent.ACTION_VIEW); smsIntent.putExtra("sms_body", "Hello World!"); smsIntent.putExtra("address", "0123456789"); …
Raj
  • 1,843
  • 2
  • 21
  • 47