Skip to main content

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

NameTypeRequiredDescription
namestringyesSpecifies 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)

NameTypeDescription
errstringerror string, null when operation is successful
dataobjectFeature status
data
NameTypeDescription
namestringThe specified feature that was checked
enabledbooleanIndicates whether the feature is installed.
presentbooleanIndicates 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.
isPermissionDeniedbooleanIndicates 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.
supportsPermissionCheckbooleanIndicates whether the specified feature supports checking for current permissions.
canRequestPermissionbooleanIndicates whether it is possible to request permission or navigate users so they are able to grant permissions for this feature.
dependenciesarrayDependencies required for the checked feature to function correctly. For instance, BackgroundGeo relies on Geo.
additionalInfoobjectData 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.

tip

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

NameTypeRequiredDescription
namestringyesspecifies the feature for which permission is being requested. The supported features are BackgroundGeo, PushNotifications, and Contacts.

callback(err, data)

NameTypeDescription
errstringerror string, null when operation is successful
databooleanSpecifies that the permission request has initiated successfully, without indicating whether the permission is ultimately granted or denied.