简体   繁体   中英

Android : No Activity found to handle Intent

I try to add "rank this app" button in my app

Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(goToMarket);  

then I get Error "Android : No Activity found to handle Intent"

BTW : I use SurfaceView I don't know if it is important

This might happen because:

  1. You're on a device where Google Play is not installed (for example, a device that's not an official Android device).
  2. Google Play is installed, but disabled (make sure it's not disabled in the settings menu).
  3. It's a rooted device and there is something nonstandard interfering with the intent launch/match mechanism.

Add try catch to prevent from crash, if there is no market app is installed in your device

try
{
context.startActivity(goToMarket);
}
catch (Exception e)
{
//Show Toast
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM