[Android-development] Requesting android.permission.READ_PHONE_STATE

Jason H jhihn at gmx.com
Wed Jan 30 23:38:40 CET 2019


So I got this figured out. A few things to note:

1. The QtCreator does not place the manually added permissions with the auto added ones?
	<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
		 Remove the comment if you do not require these default permissions. -->
	    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />


	<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
		 Remove the comment if you do not require these default features. -->
	    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
    <uses-feature android:name="android.hardware.microphone" android:required="false" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />

<uses-permission android:name="android.permission.READ_PHONE_STATE"/> <!-- this is manually added in the QtCreator "General" view -->

2. You've got to spell it right. "android.permissions.READ_PHONE_STATE" is not correct. LOL.

3. The Qt values for Granted and Denied do not match Android.  https://bugreports.qt.io/browse/QTBUG-73409



> Sent: Wednesday, January 30, 2019 at 3:59 PM
> From: "Jason H" <jhihn at gmx.com>
> To: android-development at qt-project.org
> Subject: [Android-development] Requesting android.permission.READ_PHONE_STATE
>
> So I'm trying to request android.permission.READ_PHONE_STATE, but I keep getting PERMISSION_DENIED. I know this is one of the more special ones, it's in my manifest and I'm trying to request it at runtime. 
> 
> I wrote my own mechanism in my subclassed activity, before I found http://doc.qt.io/qt-5/qtandroid.html#requestPermissionsSync
> but that one doesn't work either.
> 
> Help?
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> https://lists.qt-project.org/listinfo/android-development
> 



More information about the Android-development mailing list