usage-statistics

How to get the stats of total mobile data used in give time period(eg, last month) by all the application in android

爷,独闯天下 提交于 2019-12-05 20:17:12
I'm trying to get the mobile data used by all application in previous month( or week) or between a given time period. I want to get the mobile data usage history. I see that android is doing this by default now. Is it possible to get this information by code? Is it possible to get this information by code? Not in any documented or supported fashion, at least through Android 4.4. You are welcome to collect this data yourself by periodically examining TrafficStats , though. Try this code public void getPakagesInfoUsingHashMap() { final PackageManager pm = getPackageManager(); // get a list of

Android: Get Time Spent Per Activity

穿精又带淫゛_ 提交于 2019-12-05 14:48:16
Firstly, I'm not looking for time spent on a given application. There is already "an app for that", com.android.settings/.UsageStats , and a good deal of supporting code in the AOSP frameworks/base/services/java/com/android/server/am/UsageStatsService.java , etc. The code that I've examined so far does not seem to record elapsed time spent on particular <activity> s . I have thought to get this information two ways, but feel there must be something cleaner and simpler, that leverages more existing code. The ideas have been: Instrument the base Activity class onPause() and onResume() , to hack

Using usageStats.getTotalTimeInForeground() to get the time every application in a device spent in foreground

浪尽此生 提交于 2019-12-05 01:55:52
问题 I want to know the time spent by all applications running in an android device . I am getting all packages names using the following code .Please guide me how to link packages and the above method to get time spent by applications Here is the code List<PackageInfo> packs = getPackageManager().getInstalledPackages(0); for (PackageInfo pack : packs) { if (pack.firstInstallTime != pack.lastUpdateTime) { Log.i("n-names", pack.applicationInfo.loadLabel(getPackageManager()) .toString()); Log.i("n

How to measure desktop applicaton usage by users? [closed]

我怕爱的太早我们不能终老 提交于 2019-12-04 09:31:06
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I've wrote a app in c# .NET 3.5. People download it and use. I would like to know how many users do this and how many installed it. How to do this? 回答1: Disclaimer: I work for the company that has created the

how to get the battery usage details of installed apps?

无人久伴 提交于 2019-12-03 23:03:37
Using this code, I can find the battery level of the phone: int level = battery.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); int scale = battery.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float percent = (level / (float)scale) * 100; But how do I get the battery usage details of apps installed on phone, including that of the screen, as shown in the image below? Sorry to disappoint you, but Android's power usage APIs are not public . so there is no official way to get what you want. But you can use reflection to access some private members and methods and make use of them. You can also check

how do android monitor usage applications work

你离开我真会死。 提交于 2019-12-03 22:22:43
问题 I want to write an application that logs the usage of other applications on my phone. So for example I get the times I have entered Facebook. I understand there is no way to get a broadcastreceiver to wake up every time Facebook starts. Another way is to have a service that always runs in the background and checks for running apps and goes to sleep every second or so, but I guess this will drain my battery faster. So what is the best way this could be done? is there some kind of log I can

Using usageStats.getTotalTimeInForeground() to get the time every application in a device spent in foreground

独自空忆成欢 提交于 2019-12-03 16:26:06
I want to know the time spent by all applications running in an android device . I am getting all packages names using the following code .Please guide me how to link packages and the above method to get time spent by applications Here is the code List<PackageInfo> packs = getPackageManager().getInstalledPackages(0); for (PackageInfo pack : packs) { if (pack.firstInstallTime != pack.lastUpdateTime) { Log.i("n-names", pack.applicationInfo.loadLabel(getPackageManager()) .toString()); Log.i("n-install time", pack.firstInstallTime + ""); Log.i("n-uptime", pack.lastUpdateTime + ""); UsageStats

Android Lollipop know if app as Usage Stats access

♀尐吖头ヾ 提交于 2019-12-03 14:07:28
Since Android Lollipop, we have now an API for accessing apps usage stats. However, your app must be granted those permissions by the user. I know that for redirecting the user to those settings using Settings.ACTION_USAGE_ACCESS_SETTINGS. Now, my question is how do you know the user has granted you those permissions so that you can stop redirecting him to the settings. Thanks! tzanou you can simply query usagestats with daily interval and end time the current time and if nothing is returned this means the user hasn’t granted permissions @TargetApi(Build.VERSION_CODES.LOLLIPOP) public boolean

Android: UsageStatsManager not returning correct daily results

瘦欲@ 提交于 2019-12-03 13:54:29
问题 I'm attempting to query UsageStats from UsageStatsManager , with the aim of returning all app packages that were used daily and for how long. The Code: public static List<UsageStats> getUsageStatsList(Context context){ UsageStatsManager usm = getUsageStatsManager(context); Calendar calendar = Calendar.getInstance(); long endTime = calendar.getTimeInMillis(); calendar.add(Calendar.DAY_OF_YEAR, -1); long startTime = calendar.getTimeInMillis(); List<UsageStats> usageStatsList = usm

Interpretation of “stat_summary = mean_cl_boot” at ggplot2?

和自甴很熟 提交于 2019-12-03 12:15:13
问题 a perhaps simple question I tried to make an errorgraph like the one shown in page 532 of Field's "Discovering Statistics Using R". The code can be found here http://www.sagepub.com/dsur/study/DSUR%20R%20Script%20Files/Chapter%2012%20DSUR%20GLM3.R : line <- ggplot(gogglesData, aes(alcohol, attractiveness, colour = gender)) line + stat_summary(fun.y = mean, geom = "point") + stat_summary(fun.y = mean, geom = "line", aes(group= gender)) + stat_summary(fun.data = mean_cl_boot, geom = "errorbar",