简体   繁体   English

如何知道X或X天android使用过我的Apps?

[英]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. 如果他愿意,我想向用户显示一个Dailog框,以对我的应用程序进行网上评分。 This dialog will appear if user has used(Viewed) my app X time or if the app is in his device for x days? 如果用户使用(查看)我的应用X次,或者该应用在其设备中使用了x天,该对话框就会出现。 .

I can use SharedPreferences on my splash screen and count each time app run. 我可以在初始屏幕上使用SharedPreferences并计算每次应用运行的时间。 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. 我当时在想可能有一个组件,例如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? 在您的主要活动中,如何在onResume()中设置一个计数器(存储在SharedPreferences )?

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? 对于日期,如果还没有在您的主要活动的onResume()方法中设置日期,那么如何在SharedPreferences存储日期呢?

And the check for displaying the Dialog-Box (linking into the market) I would also add to onResume() . 显示对话框(连接到市场)的支票也将添加到onResume()

onResume() is only called if the user really sees your activity. 仅当用户真正看到您的活动时才调用onResume() Have a look here concerning the app lifecycle: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle 在此处查看有关应用程序生命周期的信息: http : //developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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