Check Capabilities

586
3
Jump to solution
12-05-2018 05:18 PM
by Anonymous User
Not applicable

The documentation on the new check capabilities AppFramework function is a little light on details at the moment. A few questions:

Which capabilities can be checked for? The intellisense in Qt Creator suggests maybe Appframework.Camera, .Location, .Microphone and .Storage??

Is it possible to test if Bluetooth permission given?

Can we test for Location vs background location independently?

Related to those but slightly different, what is the best way to test if gps and Bluetooth are actually enabled on the device? E.g. permission might be granted for location, but the user has the gps actually switched off at the time. What would be the most reliable way to test if it is on, so we could prompt the user to turn it on. 

0 Kudos
1 Solution

Accepted Solutions
ShobanaSuresh
Esri Contributor

Hi Paul,

>Which capabilities can be checked for? The intellisense in Qt Creator suggests maybe Appframework.Camera, .Location, .Microphone and .Storage??

You're right. These are the 4 capabilities currently supported by the checkCapability() method

Reference : AppFramework QML Type | ArcGIS 

>Is it possible to test if Bluetooth permission given?

Bluetooth is not covered in checkCapability() method as Bluetooth does not require permission to be granted by users at runtime.

Only requirement for Bluetooth is to enable the capability in appinfo.json. When building an app with Bluetooth capability ON, AppStudio adds the android.permission.BLUETOOTH entry to the app's Android Manifest

Permissions overview  |  Android Developers 

>Can we test for Location vs background location independently?

This is currently not supported. Can you explain a little more on the use case here? Do you want to know if the user has selected "Only when using the app"  as opposed to "Always Allow" option in the Location permission dialog that appears on iOS?

>what is the best way to test if gps and Bluetooth are actually enabled on the device?

Currently there is no API in AppFramework to check if gps and Bluetooth are enabled on the device. Is the expectation that checkCapability() method should return false in both the below cases?

- when the user has denied the permission request

- gps / bluetooth is disabled on the device

Thanks

Shobana

View solution in original post

0 Kudos
3 Replies
ShobanaSuresh
Esri Contributor

Hi Paul,

>Which capabilities can be checked for? The intellisense in Qt Creator suggests maybe Appframework.Camera, .Location, .Microphone and .Storage??

You're right. These are the 4 capabilities currently supported by the checkCapability() method

Reference : AppFramework QML Type | ArcGIS 

>Is it possible to test if Bluetooth permission given?

Bluetooth is not covered in checkCapability() method as Bluetooth does not require permission to be granted by users at runtime.

Only requirement for Bluetooth is to enable the capability in appinfo.json. When building an app with Bluetooth capability ON, AppStudio adds the android.permission.BLUETOOTH entry to the app's Android Manifest

Permissions overview  |  Android Developers 

>Can we test for Location vs background location independently?

This is currently not supported. Can you explain a little more on the use case here? Do you want to know if the user has selected "Only when using the app"  as opposed to "Always Allow" option in the Location permission dialog that appears on iOS?

>what is the best way to test if gps and Bluetooth are actually enabled on the device?

Currently there is no API in AppFramework to check if gps and Bluetooth are enabled on the device. Is the expectation that checkCapability() method should return false in both the below cases?

- when the user has denied the permission request

- gps / bluetooth is disabled on the device

Thanks

Shobana

0 Kudos
by Anonymous User
Not applicable

Hi Shobana

re Location vs background: yes - a user can choose to allow an app permission to use location "only when using the app" or "Always allow". It would be useful to be able to test what permission has been granted, as certain workflows might work, technically speaking, but produce unexpected or un-intended results if it stops working in the background. If the app could detect whether background logging permission has actually been granted by the user, then perhaps a popup could warn the user if they attempt to begin a workflow that would typically have the app become inactive (e.g. get put in their pocket while they walk around) and you know that it would only work if they had granted the correct permissions.

Re checking if gps and Bluetooth are enabled, I guess my thinking here is that it would be a totally separate check to the existing checkCapability method. As I understand it, the current method is testing for permission granted, whereas I'm also wanting to test for capability available, which is a different thing altogether. The user may have granted permission for gps location, but if they have their GPS switched off then it won't work. For Bluetooth, since there is no permission granting involved, I guess it would just be a test to see if Bluetooth is enabled. There might already be native QML ways to test for this - I'm just not sure what the best way would be.

cheers,

-Paul

0 Kudos
ShobanaSuresh
Esri Contributor

Hi Paul,

Thanks for providing additional details on the requirements. I'll create internal AppStudio enhancement issues for adding a new API for checking if GPS / Bluetooth system settings are enabled and also for improving checkCapability() to return  location vs backgroundLocation status.

Thanks

Shobana