Android Usage Access for Android 5 Samsung devices

Sorry for the late reply, I hope you have found a good solution, but if not or for other people who have this problem, this bug seems to exist in some Samsung models, to avoid the crash of your app, maybe you can check if your intent can be handled PackageManager packageManager = getActivity().getPackageManager(); if … Read more

How to create a Service which continuously monitors app usage information?

As you wrote that the task is about monitoring 3-rd party applications, there is no solution other than periodically read a list of processes and detecting foreground process. You need a service for this. Unfortunately, Android does not provide means such as broadcast events for foreground process change. The task requires a lot of code … Read more

How can I find the data usage on a per-application basis on Android?

The following links should help you figure out how to programmatically determine the data usage per application. Create a network monitor using Android’s TrafficStats class Android Traffic Statistics Inside You will need to implement your code to use the TraficStats API and track the number of bytes sent/received per UID (application).

How to check if “android.permission.PACKAGE_USAGE_STATS” permission is given?

Special permissions that are granted by the user in the system settings (usage stats access, notification access, …) are handled by AppOpsManager, which was added in Android 4.4. Note that besides user granting you access in the system settings you typically need a permission in the Android manifest (or some component), without that your app … Read more