- An implicit Intent allows you to activate an Activity if you know the action, but not the specific app or Activity that will handle that action.
- An Activity that can receive an implicit Intent must define Intent filters in the AndroidManifest.xml file that match one or more Intent actions and categories.
- The Android system matches the content of an implicit Intent and the Intent filters of any available Activity to determine which Activity to activate. If there is more than one available Activity, the system provides a chooser so the user can pick one.
- The ShareCompat.IntentBuilder class makes it easy to build an implicit Intent for sharing data to social media or email.
Go to main activity and see the openWebsite function. Note:This Intent constructor is different from the one you used to create an explicit Intent. In the previous constructor, you specified the current context and a specific component (Activity class) to send the Intent. In this constructor you specify an action and the data for that action. Actions are defined by the Intent class and can include
- ACTION_VIEW (to view the given data),
- ACTION_EDIT (to edit the given data),
- ACTION_DIAL (to dial a phone number). In this case the action is ACTION_VIEW because you want to display the web page specified by the URI in the webpage variable.
Note: we use the intent.resolveActivity() method to check if there is an app to get the intent or not. This request that matches your Intent action and data with the Intent filters for installed apps on the device. You use it to make sure there is at least one Activity that can handle your requests.
Go to main activity and see the openLocation function. Also there is a documention on location with google map in this location: https://developers.google.com/maps/documentation/urls/android-intents
You can use ShareCompat.IntentBuilder to build an Intent and launch a chooser to let the user choose the destination app for sharing. Go to main activity and see the shareText function. More Information Here: https://www.programcreek.com/java-api-examples/index.php?api=android.support.v4.app.ShareCompat
allowing an Activity in your app to respond to an implicit Intent sent from some other app. An Activity in your app can always be activated from inside or outside your app with an explicit Intent. To allow an Activity to receive an implicit Intent, you define an Intent filter in your app's AndroidManifest. xml file to indicate which types of implicit Intent your Activity is interested in handling.
we created a new activity and we are going to receive implicit intent and show the content inside a textview.
- Modify AndroidManifest.xml to add an Intent filter. we added the following lines to the activity.
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="developer.android.com" />Process the Intent: process the incoming Intent for any data or extras it includes. In this case, the incoming implicit Intent has the URI stored in the Intent data. Visit the ImplicitIntentReciever Activity to see how to recieve the data. More Information Here: https://developer.android.com/guide/components/intents-filters.html
Handing incoming Information: https://developer.android.com/training/sharing/receive