I am developing a small application which lists only those application which connects to internet. How can I read the android manifest file from the Packageinfo class to access the permission settings of each application programmatically?
private void getWebApps() {
// TODO Auto-generated method stub
PackageManager packageManager=this.getPackageManager();
List<PackageInfo> applist=packageManager.getInstalledPackages(0);
Iterator<PackageInfo> it=applist.iterator();
while(it.hasNext()){
PackageInfo pk=(PackageInfo)it.next();
String appname=pk.applicationInfo.loadLabel(packageManager).toString();
installedapplist.add(appname);
}
In the above code "installedapplist" is an arrayList which stores the apps names. But before adding to the list I need to check only those application which access the internet. Can anyone help me how to check the permission?
You could use -
getPackageManager().getInstalledPackages(PackageManager.GET_PERMISSIONS);
This returns an array of permissions. You could then iterate through it and check if the Internet one exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With