Created
August 3, 2015 16:02
-
-
Save jgc128/f0f44bfc0650556d3fda to your computer and use it in GitHub Desktop.
StartGame.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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