buildfire.diagnostics
This feature enables the application to verify the availability of specific features, such as push notifications and geolocation. Additionally, it facilitates the request for permissions related to these features.
Methods
checkFeature()
buildfire.diagnostics.checkFeature(options, callback)
This function verifies whether a feature has been integrated into the current application build.
buildfire.diagnostics.checkFeature({ name: 'BackgroundGeo' }, (err, data) => {
if (err) return console.error(err);
console.log("Data: ", data);
});
options
Name | Type | Required | Description |
---|---|---|---|
name | string | yes | Specifies the feature to be verified for its presence within the application. The supported features include: BackgroundAudio , Geo , BackgroundMode , Calendar , LocalNotifications , Sharing , BackgroundGeo , CodeScanner , IAP , PushNotifications , Health , Contacts |
callback(err, data)
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
data | object | Feature status |
data
Name | Type | Description |
---|---|---|
name | string | The specified feature that was checked |
enabled | boolean | Indicates whether the feature is installed. |
present | boolean | Indicates whether a feature is enabled or is made available using existing functionality. In certain scenarios, a feature might be marked as present even if it is not installed. For instance, when checking for the Geo feature, if it is not installed the feature can fallback to use HTML5 geo capabilities to provide the same functionality. |
isPermissionDenied | boolean | Indicates whether the permission request was denied by the user. This parameter may be null in certain scenarios, such as when present is false or if the permission check failed. |
supportsPermissionCheck | boolean | Indicates whether the specified feature supports checking for current permissions. |
canRequestPermission | boolean | Indicates whether it is possible to request permission or navigate users so they are able to grant permissions for this feature. |
dependencies | array | Dependencies required for the checked feature to function correctly. For instance, BackgroundGeo relies on Geo . |
additionalInfo | object | Data that are specific to the requested feature. Currently, only supported in BackgroundGeo and would return { currentPermission: status } where status is the OS status of the underlying permission. |
requestFeaturePermission()
buildfire.diagnostics.requestFeaturePermission(options, callback)
This function initiates a request for permission to use a specific feature either as a direct permission request or to navigate users to app settings screen where they can change permissions.
This function is typically required when a user initially denies permission for a feature but decides to grant permission at a later time.
buildfire.diagnostics.requestFeaturePermission({ name: 'BackgroundGeo' }, (err, data) => {
if (err) return console.error(err);
console.log("Permission request status: ", data)
});
options
Name | Type | Required | Description |
---|---|---|---|
name | string | yes | specifies the feature for which permission is being requested. The supported features are BackgroundGeo , PushNotifications , and Contacts . |
callback(err, data)
Name | Type | Description |
---|---|---|
err | string | error string, null when operation is successful |
data | boolean | Specifies that the permission request has initiated successfully, without indicating whether the permission is ultimately granted or denied. |