Advertisement
Pepokamal

Prompt engaged users to rate your app in the Android market

Jan 8th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1.  
  2. raw ·
  3. copy
  4. · downloadpublic class AppRater {
  5. private final static String APP_TITLE = "YOUR-APP-NAME";
  6. private final static String APP_PNAME = "YOUR-PACKAGE-NAME";
  7.  
  8. private final static int DAYS_UNTIL_PROMPT = 3;
  9. private final static int LAUNCHES_UNTIL_PROMPT = 7;
  10.  
  11. public static void app_launched(Context mContext) {
  12. SharedPreferences prefs = mContext.getSharedPreferences("apprater", 0);
  13. if (prefs.getBoolean("dontshowagain", false)) { return ; }
  14.  
  15. SharedPreferences.Editor editor = prefs.edit();
  16.  
  17. // Increment launch counter
  18. long launch_count = prefs.getLong("launch_count", 0) + 1;
  19. editor.putLong("launch_count", launch_count);
  20.  
  21. // Get date of first launch
  22. Long date_firstLaunch = prefs.getLong("date_firstlaunch", 0);
  23. if (date_firstLaunch == 0) {
  24. date_firstLaunch = System.currentTimeMillis();
  25. editor.putLong("date_firstlaunch", date_firstLaunch
  26. You can see more on
  27. http://pladollmo.com/1odK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement