PomepuyN / discreet-app-rate

A lightweight non intrusive app rate reminder for Android
http://nicolaspomepuy.fr/non-intrusive-app-rate
Apache License 2.0
464 stars 51 forks source link

Crash on click if no app installed which can handle "market://" intent #36

Open alexeyvasilyev opened 9 years ago

alexeyvasilyev commented 9 years ago

Steps to reproduce:

  1. Run in emulator or any other device which do not have Google Play installed.
  2. Call forceShow(). The apprate is shown.
  3. Press on AppRate to get a crash android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.myproject flg=0x10000000 }

Fix 1: In forceShow() should be if (!Utils.isGooglePlayInstalled(activity)) { if (debug) LogD("Play Store is not installed. Won't do anything"); return; }

instead of if (!Utils.isGooglePlayInstalled(activity)) { if (debug) LogD("Play Store is not installed. Won't do anything"); }

Fix 2: Use try {} catch (Exception e) {} in onClick() while calling Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent);

PomepuyN commented 9 years ago

Will be fixed in the next version.