简体   繁体   English

用户运行我的应用多少次?

[英]How many times has a user run my app?

I am making a android application right now in Java.我现在正在用 Java 制作一个 android 应用程序。

  • Can I know how many times my application has been run in a day?我可以知道我的应用程序一天运行了多少次吗?

Cos if I put a counter in the main method, it will be equal to 1 after each new start.因为如果我在 main 方法中放一个计数器,每次新开始后它都会等于 1。 If I use the SharedPreference to count, the counter will not be equal to 1 the NEXT day.如果我使用SharedPreference进行计数,则 NEXT 一天的计数器将不等于 1。 I want it so that every new day the counter will be equal to 1, but if the day is still the same, the counter will continue to increase.我希望它使每个新的一天计数器都等于 1,但如果当天仍然相同,计数器将继续增加。 (If user runs the application a third time, the counter will be equal to 3). (如果用户第三次运行应用程序,计数器将等于 3)。

I am implying that I have to use DATA, but I have no idea how.我的意思是我必须使用 DATA,但我不知道如何使用。

you can use Calendar to see if you are in today or not.您可以使用日历查看您是否在今天。 then you can use a counter inside your first activity to count number of app's start.那么你可以在你的第一个活动中使用一个计数器来计算应用程序的启动次数。 and you can store this info into database.您可以将此信息存储到数据库中。

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

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