Reposting my previously deleted answer once again
Here is a working way to find out if it's granted (tested on MIUI 14.0.3)
public static final int OP_BACKGROUND_START_ACTIVITY = 10021;
@SuppressWarnings("JavaReflectionMemberAccess")
@TargetApi(19)
public static boolean isBackgroundStartActivityPermissionGranted(Context context) {
try {
AppOpsManager mgr = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
Method m = AppOpsManager.class.getMethod("checkOpNoThrow", int.class, int.class, String.class);
int result = (int) m.invoke(mgr, OP_BACKGROUND_START_ACTIVITY, android.os.Process.myUid(), context.getPackageName());
return result == AppOpsManager.MODE_ALLOWED;
} catch (Exception e) {
Log.d("Exception", e.toString());
}
return true;
}
You can find an even more detailed code here: https://github.com/zoontek/react-native-permissions/issues/412#issuecomment-1590376224