Often, we have to integrate our apps with existing apps on the user's device. This is simply because we will never be able to cover all the possible actions a user may wish to perform.
Using Intents
, we can launch specific activities in other apps:
We can start other activities, such as the default map app, using the
ActionView
intent and a URI, as follows:var uri = Uri.Parse("geo:37.797786,-122.401855"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent);
Some activities require that a type be specified instead of a URI; which is done as shown here:
var intent = new Intent(Intent.ActionSend); intent.SetType("text/plain"); intent.PutExtra( Intent.ExtraEmail, new[]{"[email protected]"}); intent.PutExtra( Intent.ExtraSubject, "Email Subject"); intent.PutExtra( Intent.ExtraText, "Email message text here..."); StartActivity(intent);
If the user has selected a default app for a particular intent, for example when the user chooses to always...