@goki-lock/react-native-utils
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

@goki-lock/react-native-utils

Check all requirements & make the app ready to do bluetooth communication

Installation

yarn add @goki-lock/react-native-utils

Usage

import GokiLockUtils, {ErrorCodeType} from '@goki-lock/react-native-utils';

Listen to bluetooth state changes

const subscription = GokiLockUtils.addBluetoothStateListener((state) => {
  console.log(state);
})

Check bluetooth state

GokiLockUtils.getBluetoothState().then((state) => {
  console.log(state);
})

request to enable bluetooth

GokiLockUtils.requestToEnableBluetooth()

open bluetooth settings

GokiLockUtils.openBluetoothSettings()

enable/disable bluetooth (Android only)

needs bluetooth admin permission

GokiLockUtils.enableBluetooth()
GokiLockUtils.disableBluetooth()

open location source settings (Android only)

GokiLockUtils.openLocationSourceSettings()

open app details settings (Android only)

GokiLockUtils.openAppDetailsSettings()

check location service is enabled

GokiLockUtils.isLocationServiceEnabled().then((enabled) => {
  console.log(enabled);
})

check all conditions

GokiLockUtils.checkRequirements({
  openLocationSettings: true,
  openBluetoothSettings: true,
  fixLocation: true,
  fixBluetooth: true,
}).then(() => {

})
  .catch((error) => {
    // error.code = ErrorCodeType
    console.log(error);
  })

related packages

most of native codes are based on following packages

Package Sidebar

Install

npm i @goki-lock/react-native-utils

Repository

goki.travel

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

316 kB

Total Files

95

Last publish

Collaborators

  • mobile.goki.travel
  • a.dehnavi