Issue
iOS 13 started to request Bluetooth permission. When bluetooth permission isn't granted yet, I want to show a custom screen to explain why I need the Bluetooth and suggest to give the app an access to it. Before that I have to check if bluetooth permission is granted or not.
This function immediately shows native popup and asks for the permission:
public bool NeedsBluetoothPermission()
{
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
return CBCentralManager.Authorization != CBManagerAuthorization.AllowedAlways;
}
else
{
return false;
}
}
Question: How to check if the app needs to request bluetooth permissions without triggering native popup first?
This answer doesn't work for me, as I don't create any instance of CBCentralManager yet, I only use its static property.
Native iOS developers, please chime in too. I guess it's not Xamarin problem only...
Solution
Finally, I figured this out. This behavior was actual for iOS 13.0 beta.
For the latest iOS 13.2 I don't observe this issue.
I'm able to check CBCentralManager.Authorization property silently. The system pop-up shows up when I create an instance of CBCentralManager.
Answered By - LGFox
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.