iOS Question [SOLVED] Is it possible to verify authorization status?

Similar threads

B4i Tutorial Location & GPS
B4A Tutorial [B4X] [B4XPages] Pleroma / Mastodon Client
B4A Class [class][B4X] Google OAuth2
B4i Question verify Receipt with php
B4i Code Snippet Full screen apps

Sandman

Well-Known Member
Licensed User
Let's say one requests, and is granted, access to Location:
B4X:
#PlistExtra:<key>NSLocationUsageDescription</key><string>Text goes here</string>
For Location, I can see that we have the event AuthorizationStatusChanged to use to check the status, which is great, because I can use that to communicate something to the user. Like "You removed access to Location so feature X won't work. Go to Settings and give back the access and try again."

However, let's say we requested, and was granted, access to the Camera:
B4X:
#PlistExtra:<key>NSCameraUsageDescription</key><string>Text goes here</string>
Then the user went into Settings -> AppName and removed the access to the camera. Now, when the user presses the Take Picture button in the app, the OS automatically opens the settings page for the app (which shows lots of info), and the user is supposed to understand by herself that "oh, I mistakenly removed the camera access, better give it back for the app to work". I don't really trust my users to make that mental connection. I rather think it's going to be a "I tapped the picture button and somehow I ended up here - app is clearly broken." I want to avoid this. At the very least I want to verify the access and pop open a message: "You will now see this apps Settings. Please enable the camera access and return here."

Is there a generic way to verify the accesses that we have requested?

(While searching the forum for this I found a post regarding ALAssetsLibrary from @narek adonts , which looks promising. That post mentions a method authorizationStatus, which I used to get these search results from Apple. It's quite difficult for me though to translate the Apple info to something like the post mentioned.)
 
Top