Skip to content

Instantly share code, notes, and snippets.

@scruffyfox
Last active August 29, 2015 14:07
Show Gist options
  • Save scruffyfox/a6b6cc13c8da72c02677 to your computer and use it in GitHub Desktop.
Save scruffyfox/a6b6cc13c8da72c02677 to your computer and use it in GitHub Desktop.
Intent firstAidIntent;
PackageManager manager = getPackageManager();
try
{
firstAidIntent = manager.getLaunchIntentForPackage("com.cube.arc.fa");
if (firstAidIntent == null)
{
throw new PackageManager.NameNotFoundException();
}
firstAidIntent.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(firstAidIntent);
}
catch (PackageManager.NameNotFoundException e)
{
firstAidIntent = new Intent(Intent.ACTION_VIEW);
firstAidIntent.setData(Uri.parse("market://details?id=com.cube.arc.fa"));
startActivity(firstAidIntent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment