Is there anyway in android sdk where they provide an information for specific permission? Like how google play does, whenever you click on a permission you are able to read what does this permission do. I have this function to return me specific permissions for an application
public static List<String> getAppPermissions(Context context, String packageName) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
return Arrays.asList(info.requestedPermissions);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return new ArrayList<>();
}
}
By this code im getting only permission names, but I'm wondering if there is any such api that return permissions and their details.
There's no way to find out whether the Auto-start option is enabled or not. You can manually check under Security permissions => Autostart => Enable Autostart .
shouldShowRequestPermissionRationale. Gets whether you should show UI with rationale before requesting a permission. The target activity. A permission your app wants to request.
Is it possible to display the "App Permissions" screen for a specific app via an Intent or something similar? It is possible to display the app's "App Info" screen in Settings with the following code: startActivity( new Intent( android. provider.
to answer my question, PermissionInfo
is actually the right class
to get a description about any android permission
for example:
@Nullable
public static PermissionInfo getPermissionInfo(@NonNull Context context, @NonNull String permission) {
try {
return context.getPackageManager().getPermissionInfo(permission, PackageManager.GET_META_DATA);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return null;
}
above method will return PermissionInfo
instance if it could parse the permission
name given to it, and then simply you could call loadDescription
to load the permission
description.
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