Core package for the OkHi react native suite of libraries
npm install @okhi/react-native-core
import {
isGooglePlayServicesAvailable,
isLocationPermissionGranted,
isLocationServicesEnabled,
requestEnableGooglePlayServices,
requestEnableLocationServices,
requestLocationPermission,
isBackgroundLocationPermissionGranted,
requestBackgroundLocationPermission,
} from '@okhi/react-native-core';
async function checkPermissions() {
if (!(await isGooglePlayServicesAvailable())) {
await requestEnableGooglePlayServices(); // resolves true | false
}
if (!(await isLocationPermissionGranted())) {
await requestLocationPermission(); // resolves true | false
}
if (!(await isLocationServicesEnabled())) {
await requestEnableLocationServices(); // resolves true | false
}
if (!(await isBackgroundLocationPermissionGranted())) {
await requestBackgroundLocationPermission(); // resolves true | false
}
}
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Checks whether background location permission is granted.
A promise that resolves to a boolean value indicating whether or not the permission is granted.
Checks whether Google Play Service is available and turned on.
A promise that resolves to a boolean value indicating whether or not the the service is available.
Checks whether foreground location permission is granted.
A promise that resolves to a boolean value indicating whether or not the permission is granted.
Checks whether location services are available and turned on.
A promise that resolves to a boolean value indicating whether or not the the service is available.
Launches the user's devices location settings, enabling them to turn on location services.
Requests background location permission from the user.
A promise that resolves to a boolean value indicating whether or not the the permission is granted.
Launches the device's Google Play Services settings, prompting the user to enable the service.
A promise that resolves to a boolean value indicating whether or not the the service is available.
Displays an in app native modal, that prompts the user to enable location services.
A promise that resolves to a boolean value indicating whether or not the the service is available.
Requests foreground location permission from the user.
A promise that resolves to a boolean value indicating whether or not the the permission is granted.
Generated using TypeDoc
Sets the current mode that you'd like to use OkHi's services.