0

我有兴趣编写一个应用程序来记录那些已安装的应用程序如何使用我手机上的资源。这些资源可以是麦克风、相机、蓝牙、GPS、联系人、网络、电池使用情况、传感器等。我想记录应用程序使用资源的时间和时间。

android上是否有任何API可以用来访问这些信息?

提前感谢您的时间和建议!

4

1 回答 1

0

使用此代码。ihope 会帮助你

 PackageManager packageManager = this.getPackageManager();
                List<PackageInfo> applist = packageManager.getInstalledPackages(0);
                Iterator<PackageInfo> it = applist.iterator();
                while (it.hasNext()) {
                    PackageInfo pk = (PackageInfo) it.next();
                    if (PackageManager.PERMISSION_GRANTED == packageManager.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION, pk.packageName)) //checking if the package is having INTERNET permission
                    {
                        results.add("" + pk.applicationInfo.loadLabel(packageManager));
                    }
                }

https://github.com/commonsguy/cw-andtuning/tree/master/TrafficMonitor

http://www.techrepublic.com/blog/app-builder/create-a-network-monitor-using-androids-trafficstats-class/774

http://agolovatyuk.blogspot.com/2012/04/android-traffic-statistics-inside.html

还要检查这些链接:)

于 2015-11-13T11:25:28.917 回答