Skip to content

Instantly share code, notes, and snippets.

@jgc128
Created August 3, 2015 16:02
Show Gist options
  • Save jgc128/f0f44bfc0650556d3fda to your computer and use it in GitHub Desktop.
Save jgc128/f0f44bfc0650556d3fda to your computer and use it in GitHub Desktop.
StartGame.
var gamePackageName = Resources.GetString(Resource.String.game_package_name);
var gameIntent = PackageManager.GetLaunchIntentForPackage(gamePackageName);
if (gameIntent == null)
{
try {
StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse("market://details?id=" + gamePackageName)));
} catch (ActivityNotFoundException) {
StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://play.google.com/store/apps/details?id=" + gamePackageName)));
}
}
else
{
StartActivity(gameIntent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment