简体   繁体   中英

How to know My Apps is used X time or X days android?

I want to show user a dailog box for rate my app on net if he likes. This dialog will appear if user has used(Viewed) my app X time or if the app is in his device for x days? .

I can use SharedPreferences on my splash screen and count each time app run. But I am wondering what if user not finish by pressing home. In this case the app will not launch. So what the solution?

I was thinking there may be a component for this,like IPhone AppRater. Please tell me if any. Or let me know how to do this.

Thanks

How about setting a counter (stored in SharedPreferences ) in onResume() in your main activity?

And for the date, how about storing a date in SharedPreferences if the date is not already set also in the onResume() -method of your main activity?

And the check for displaying the Dialog-Box (linking into the market) I would also add to onResume() .

onResume() is only called if the user really sees your activity. Have a look here concerning the app lifecycle: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

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