Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- raw ·
- copy
- · downloadpublic class AppRater {
- private final static String APP_TITLE = "YOUR-APP-NAME";
- private final static String APP_PNAME = "YOUR-PACKAGE-NAME";
- private final static int DAYS_UNTIL_PROMPT = 3;
- private final static int LAUNCHES_UNTIL_PROMPT = 7;
- public static void app_launched(Context mContext) {
- SharedPreferences prefs = mContext.getSharedPreferences("apprater", 0);
- if (prefs.getBoolean("dontshowagain", false)) { return ; }
- SharedPreferences.Editor editor = prefs.edit();
- // Increment launch counter
- long launch_count = prefs.getLong("launch_count", 0) + 1;
- editor.putLong("launch_count", launch_count);
- // Get date of first launch
- Long date_firstLaunch = prefs.getLong("date_firstlaunch", 0);
- if (date_firstLaunch == 0) {
- date_firstLaunch = System.currentTimeMillis();
- editor.putLong("date_firstlaunch", date_firstLaunch
- You can see more on
- http://pladollmo.com/1odK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement