Android 13 Restricted Settings(Accessibility) API
Asked Answered
N

2

4

I've tested Android 13 devices and I've seen that some of them use the "Restricted Settings" and others don't. I want to check programatically if the current device has that feature. Is there some kind of API for that?

Nicol answered 31/8, 2022 at 10:57 Comment(7)
You can check this official doc developer.android.com/about/versions/13/behavior-changes-13Incunabulum
@MohammadMisbah Thank you, but I haven't seen anything related to accessibility restrictions and\or API.Nicol
Okay, @Sharon - Could you please explain your use case? It would be great if I can help in any way.Incunabulum
@MohammadMisbah My app is not from the Play Market and it requires accessibility permissions. Since Android 13 introduced Restricted Settings and accessibility can no longer easily turned on, I want to help my customers to turn it on (App info -> 3 dots -> disable restricted settings). As I said, some of the tested devices include RS feature while others dont. In conclusion, Im looking for a way to know if the current Android 13 device has RS feature or not (so I would know whether I need to guide the customer, or not).Nicol
@SharonMishayev, "Im looking for a way to know if the current Android 13 device has RS feature or not", you found a solution to it?Evelinevelina
@Evelinevelina No, as far as I know there is no straightforward way.Nicol
@SherMi do you have any update?Angkor
E
0

enter image description here

I also have this issue so I will try to explain in case anyone can help.

Basically we need to detect if the service is disabled on android 13 so we can navigate the user to settings so they can enable the unsafe perm then enable the service.

Is there some settings variable that we can use.

Better demonstrated by this video https://www.youtube.com/watch?v=0bcLjpfrmHw

But I believe i found the answer on a post

public static boolean hasAccessRestrictedPerm(Context context) {
try {
    PackageManager packageManager = context.getPackageManager();
    ApplicationInfo applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 0);
    AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
    int mode = appOpsManager.checkOpNoThrow("android:access_restricted_settings", applicationInfo.uid, applicationInfo.packageName);
    return (mode == AppOpsManager.MODE_ALLOWED);
} catch (PackageManager.NameNotFoundException e) {
    return false;
}

}

Emmeram answered 25/9, 2023 at 18:30 Comment(0)
T
0

In android 13 If restricted settings error means Your app should be live on play store. First your app live then restricted settings gone. No need to do extra stuff for android 13. Happy coding

Tolkan answered 23/2 at 10:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.