O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required