Android Question Wait for permissions never comes back

nibbo

Active Member
Licensed User
Longtime User
Hi

Wait for B4XPage_PermissionResult never comes back

Below is the code which I copied from the B4XPages Bluetooth Cat example:

B4X:
Log("Checking Permissions")
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Log("Permission Result = " Result)

In the log I can see the 'Checking Permissions', and, if I haven't already granted permission if does actually request it.
After granting permission it never returns to the 'Wait For' bit so I never see the permissions result message in the log.
It doesn't crash or anything, just sits there...
I do see a peculiar message (below) if I untick the filter but that does not look like it is related.

B4X:
Checking Permissions
Class androidx.core.content.ContextCompat failed lock verification and will run slower.

Any ideas?

Thanks
 
Last edited:

nibbo

Active Member
Licensed User
Longtime User
Did you add the permission to the manifest? (had the same issue today)

Thanks KMatle but yes the permission is in the manifest.

Not sure what B4XPage_PermissionResult is but I found another post that suggested changing it to Activity_PermissionResult and that seems to work.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Not sure what B4XPage_PermissionResult is but I found another post that suggested changing it to Activity_PermissionResult and that seems to work.
This, as I found out when making the B4XPages widget, is that if you use B4XPages then "B4XPage_PermissionResult " works, else in Activity "Activity_PermissionResult " works.

Regards,

Anand
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Not sure what B4XPage_PermissionResult is but I found another post that suggested changing it to Activity_PermissionResult and that seems to work.
If you have created a B4XPage project then you should be using the following.
B4X:
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
Working fine here, don't forget to add a reference that needs locations...
 

Attachments

  • Test.zip
    9.8 KB · Views: 94
Upvote 0

nibbo

Active Member
Licensed User
Longtime User

It was a B4XPage project but still Activity_PermissionResult works and B4XPage_PermissionResult does not.
Not really an issue as I have abandoned B4XPage anyway and sticking with Activities...

Thanks
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Activity_PermissionResult works and B4XPage_PermissionResult does not.
Hello @nibbo,
That's an incorrect statement that can easy put other developers off from from using B4XPages if they read it. You obviously did something incorrectly, nevertheless as long as you have got your project working that's all that really matters at the end of the day.

Anyway back to normality, I'll be in your neck of the woods tomorrow for a nice break away.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…