Android Question permission error in release mode only

akinnovation

Member
Licensed User
Longtime User
Hi all,

If I use the runtime permission function CheckAndRequest.
First I see the normal message, one for every permission request. After these, only in release mode, I have the error I copied below.
error:
Logger connesso a:  Teclast P40HD_ROW
--------- beginning of main
*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
----Activ_res---- & DB Init
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
sending message to waiting queue (activity_permissionresult)
running waiting messages (2)
main$ResumeMessagerun (java line: 313)
java.lang.Exception: Sub activity_permissionresult was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:227)
    at anywheresoftware.b4a.BA$2.run(BA.java:395)
    at anywheresoftware.b4a.BA.setActivityPaused(BA.java:467)
    at ak.ritiri.main$ResumeMessage.run(main.java:313)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7941)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:553)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
The code in activity_create is:
code:
    If FirstTime Then
        rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
        rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    End If
In debug mode all work fine.
this is the permissions list of the App

Please help me, what is my mistake ?
Thanks to all.

P.S. if I don't put into the firsttime if, in release mode gave me the same error every time I run the App!
 

Attachments

  • listapermessi.png
    17.9 KB · Views: 48
Solution
try this:
B4X:
    For Each per In Array(rp.PERMISSION_ACCESS_FINE_LOCATION, rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        rp.CheckAndRequest(per)
        Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
        If Not (Result) Then
            Msgbox("No permission, no party","")
            Activity.Finish
            Return 
        End If
    Next

walterf25

Expert
Licensed User
Longtime User
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
try this:
B4X:
    For Each per In Array(rp.PERMISSION_ACCESS_FINE_LOCATION, rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        rp.CheckAndRequest(per)
        Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
        If Not (Result) Then
            Msgbox("No permission, no party","")
            Activity.Finish
            Return 
        End If
    Next
 
Upvote 0
Solution

akinnovation

Member
Licensed User
Longtime User
Many thanks sirijo66, it work fine now also in release mode !
So I must wait also for the runtimepermission.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…