Is there any option to check the status of accessibility permission in android ( whether it is granted to the app or not ).
tried both (from this post)
private boolean checkWriteExternalPermission()
{
String permission = Manifest.permission.BIND_ACCESSIBILITY_SERVICE;
int res = getContext().checkCallingOrSelfPermission(permission);
return (res == PackageManager.PERMISSION_GRANTED);
}
and
PackageManager pm = context.getPackageManager();
int hasPerm = pm.checkPermission(
android.Manifest.permission.BIND_ACCESSIBILITY_SERVICE,
context.getPackageName());
if (hasPerm != PackageManager.PERMISSION_GRANTED) {
// do stuff
}
but in both cases the result is negative irrespective of status of the permission . even if the service is using the permission result is -1
Please check the comments for correct answer, it is no longer able to receive answers. thanks to abdu and Duna