Launching other apps

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.

How to do it...

Using Intents, we can launch specific activities in other apps:

  1. 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);
  2. 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[]{"user@example.com"}); intent.PutExtra( ...

Get Xamarin Mobile Development for Android Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.