Android Question Requesting permission not working

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have the following:

Having troubles on moving to sdk = "26" On android 4.4.4 (samsung tab e)

B4X:
Sub Activity_Create(FirstTime As Boolean)
    ReqPermissions

....

Sub ReqPermissions
    For Each permission As String In Array(rp.PERMISSION_ACCESS_FINE_LOCATION, rp.PERMISSION_WRITE_EXTERNAL_STORAGE, rp.PERMISSION_ACCESS_COARSE_LOCATION)
        rp.CheckAndRequest(permission)
        Wait For Activity_PermissionResult (permission As String, Result As Boolean)
        If Result = False Then
            ToastMessageShow("No Permissions", True)
            Activity.Finish
            Return
        End If
    Next
End Sub

It is always getting to the result = false

My manifest:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="14"
        android:targetSdkVersion="26"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:largeScreens="true"
    android:xlargeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)

AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />)

AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.bluetooth" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.accessory" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.host" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.FAKETOUCH" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.LOCATION" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.location.GPS" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.location.NETWORK" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.WIFI" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.touchscreen" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.WAKE_LOCK" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.ACCESS_FINE_LOCATION" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.ACCESS_COARSE_LOCATION" android:required="false" />)

AddActivityText(main, <intent-filter >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>)   
SetActivityAttribute(main, android:windowSoftInputMode, adjustPan|stateHidden)

I Have all these AddManifestText to get rid of some bad chinese tablets taht customers are using here. The app works on that tablets, but my app is filtered out by Play Store and does not show up to install

My List Permissions:
upload_2018-11-2_17-10-55.png
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
I'm sure I read somewhere that if you request a permission that isn't actually required by the app, it will always return false. Your permissions list doesn't include "ACCESS_COARSE_LOCATION", but you are requesting it - so maybe that's causing the "false".

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Also - I'm not 100% sure your loop will work as you expect. Have you tried stepping through it to see where how you are ending up with a false result?

- Colin.
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
Also - I'm not 100% sure your loop will work as you expect. Have you tried stepping through it to see where how you are ending up with a false result?

- Colin.
You correct PERMISSION_ACCESS_COARSE_LOCATION is not needed, I removed from the request and worked.

My problem now is:

android.permission.WRITE_EXTERNAL_STORAGE with maxSdkVersions

When uploading to play store. I have removed all the WRITE_EXTERNAL_STORAGE but this one:
upload_2018-11-2_18-4-59.png
 
Upvote 0
Top