Handle checkPermission() below api 23
Although Qt 6 supports API 23+, it's still not bad to do this fix, it
achieves two things:
* Avoid the use of reflection when checking for permission state
* It works for all api versions
With this we would be sure we don't need to do a check in c++
if (androidSdkVersion < 23)
return true;
The platform api checks if permission is granted or not, irrelevant of
the api version.
Change-Id: I9766dc35bbc8347ad0d60fde54b95710c8866736
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
bb10
parent
c113c88aa2
commit
f379446230
|
|
@ -843,13 +843,8 @@ public class QtNative
|
|||
int perm = PackageManager.PERMISSION_DENIED;
|
||||
synchronized (m_mainActivityMutex) {
|
||||
Context context = getContext();
|
||||
try {
|
||||
if (m_checkSelfPermissionMethod == null)
|
||||
m_checkSelfPermissionMethod = Context.class.getMethod("checkSelfPermission", String.class);
|
||||
perm = (Integer)m_checkSelfPermissionMethod.invoke(context, permission);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PackageManager pm = context.getPackageManager();
|
||||
perm = pm.checkPermission(permission, context.getPackageName());
|
||||
}
|
||||
|
||||
return perm;
|
||||
|
|
|
|||
Loading…
Reference in New Issue