Android permission not asked correctly with version 31 - android

I have a Android app done with Delphi 10.4 (upgraded to 11.2).
I have lot of permission in my AndroidManifest.xml :
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="oppo.permission.OPPO_COMPONENT_SAFE"/>
<uses-permission android:name="com.huawei.permission.external_app_settings.USE_COMPONENT"/>
Then I ask for runtime permissions :
PermissionsService.RequestPermissions(
[JStringToString(TJManifest_permission.JavaClass.CAMERA),
JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE),
JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE),
JStringToString(TJManifest_permission.JavaClass.READ_PHONE_STATE),
JStringToString(TJManifest_permission.JavaClass.RECORD_AUDIO)
], ...
That's work perfectly, but when I want to publish my app, Play store ask to update my Sdk version to 31 (I replace 29 by targetSdkVersion="31")
I add exported=true when necessary and replace :
<uses-permission android:name="android.permission.BLUETOOTH"/>
// by
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/>
// and added BLUETOOTH_SCAN + BLUETOOTH_ADVERTISE + BLUETOOTH_CONNECT
On Android 13, permission are not asked correctly.
The first time I open the app, the application ask me to accept BLUETOOTH only and then nothing append, but the app still working and crash when I want use the Camera.
If I close the app and open it, then my application ask me for the others permissions (Camera, Read/Write, ..)
I try to put Bluetooth at the end of the file, but I got same problem.
If I use targetSdkVersion="29" as before, it's ok.
Based on the documentation I dont see what to do : https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#declare-android12-or-higher
Thanks

I faced a similar issue. I had to move the code of asking for the permissions to different places. So when the application starts, I ask for Bluetooth permissions only. Before using the storage, I added to code to ask for the storage permission. Before using the camera, I did the same.

Related

Android permissions ask something I don't want

I'm making a React-Native app and in the AndroidManifest.xml file, I ask some things :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />
As you can see, I never ask my app to access to the contacts.
However, when I build my app, she ask me the permission to access to my contacts.
Have you an idea ? Thanks !
You can check which dependency has added the permission by looking at the
android/app/build/outputs/logs/manifest-merger-debug-report.txt log.

Google Play Console - Android Bundle Permissions problem

I created my first android app in Expo, that i made the eject later on. I created the bundle and uploaded to the Google Play console, but in the list permissions appears:
android.permission.ACCESS_BACKGROUND_LOCATION,
android.permission.ACCESS_COARSE_LOCATION,
android.permission.ACCESS_FINE_LOCATION,
android.permission.ACCESS_NETWORK_STATE,
android.permission.ACCESS_WIFI_STATE,
android.permission.CAMERA,
android.permission.FOREGROUND_SERVICE,
android.permission.INTERNET,
android.permission.READ_APP_BADGE,
android.permission.READ_EXTERNAL_STORAGE,
android.permission.RECEIVE_BOOT_COMPLETED,
android.permission.SYSTEM_ALERT_WINDOW,
android.permission.WAKE_LOCK,
android.permission.WRITE_EXTERNAL_STORAGE,
android.permission.WRITE_SETTINGS,
com.anddoes.launcher.permission.UPDATE_COUNT,
com.android.vending.CHECK_LICENSE,
com.google.android.c2dm.permission.RECEIVE,
com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE,
com.google.android.gms.permission.ACTIVITY_RECOGNITION,
com.google.android.providers.gsf.permission.READ_GSERVICES,
com.htc.launcher.permission.READ_SETTINGS,
com.htc.launcher.permission.UPDATE_SHORTCUT,
com.huawei.android.launcher.permission.CHANGE_BADGE,
com.huawei.android.launcher.permission.READ_SETTINGS,
com.huawei.android.launcher.permission.WRITE_SETTINGS,
com.majeur.launcher.permission.UPDATE_BADGE,
com.oppo.launcher.permission.READ_SETTINGS,
com.oppo.launcher.permission.WRITE_SETTINGS,
com.sec.android.provider.badge.permission.READ,
com.sec.android.provider.badge.permission.WRITE,
com.sonyericsson.home.permission.BROADCAST_BADGE,
com.sonymobile.home.permission.PROVIDER_INSERT_BADGE,
me.everything.badger.permission.BADGE_COUNT_READ,
me.everything.badger.permission.BADGE_COUNT_WRITE
But in my AndroidManifest.xml i only have this:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission tools:node="remove" android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
Can anybody help me? Thanks!
Ok, I checked that the permissions that appear are merged with my AndroidManifest.xml in the build. These are permissions required by packages that I added to my project. To help check which packages are needed I go to android > app > build > outputs > logs > manifest-merger-release-report.txt.
Hope it help others with the same problem :)

Which permissions do I need to call requestPermission() - Android

I'm setting up some permissions in my AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
I request the permission on runtime for all of those permissions.
But somehow the permission REQUEST_INSTALL_PACKAGES does not need to call requestPermission(). If I try to call it anyway, the popup never appears.
Is there a list of permissions i need to call at runtime?
My current android version is 8.0.0.
Thanks
Depends on type of permission you are requesting for. There are two kind of permissions in Android: Normal and Dangerous Permissions
If there are dangerous, you must request for it at runtime for API level 23 and above.
For more info you should read following documentation: https://developer.android.com/guide/topics/permissions/requesting.html#normal-dangerous

My App is asking "Microphone: record audio" permission even thought i am not using it

below are permission that i am using
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
there is no microphone permission in my Manifest then why playstore is asking for "MicroPhone" permission while app installation
Although dmitriyzaitsev 's answer is right, I wanted to append it with a method for checking how you can find out which modules add which permissions. To do that, you need to go to the following file:
app/build/outputs/logs/manifest-merger-<app_flavor>-report.txt
There you can search for the permission you are interested in, e.g. RECORD_AUDIO. Your result should look something like this:
ADDED from [com.google.firebase:firebase-common:11.2.2] /Users/jakubkomorowski/.gradle/caches/transforms-1/files-1.1/firebase-common-11.2.2.aar/7f3b39613ed1e03ef066f866e7495b17/AndroidManifest.xml:6:79-143
uses-permission#android.permission.RECORD_AUDIO
You can find out more in the google developer documentation
It seems your app module depends on some other libraries that use this permission.
It's not necessary that microphone audio permission is declared in your AndroidManifest. It can be declared in 3rd-party library.

Getting unavailable feature android.hardware.sdcard; failing! error when sdcard is present in Android

I am getting the following error when I am trying to install my app on my HTC device.
Package com.org.activities requires unavailable feature
android.hardware.sdcard; failing!
However, I do have my SD card in my device.
Here is the code I have written in my manifest file:
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.sdcard" android:required="true"/>
<uses-feature android:name="android.hardware.camera" android:required="true"/>
What's wrong with it? I need to check for these features as I am using an SD card and the camera for my app.
This hardware feature does not seem to exist. I can't find it in the reference?
http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features
How did you arrive at this feature name?

Categories

Resources