Goki lock sdk for react-native
how to install
yarn add @goki-lock/react-native
or
npm install @goki-lock/react-native
then add the stream
alias to your metro.config.js
& install stream-browserify
if needed
module.exports = {
// ...
resolver: {
extraNodeModules: {
'stream': require.resolve('stream-browserify'),
},
},
//...
}
please follow react-native-ble-plx@2.+ documentation and install it and add the required permissions to your app.
Please make sure these requirements are met before calling the sdk methods other it will fail.
- iOS requirements
- bluetooth should be on in both control center and settings
- bluetooth permission needs to be granted
- Android requirements
- bluetooth should be on
- bluetooth permission needs to be granted
- location permission needs to be granted
- location service needs to be enabled
you can use @goki-lock/react-native-utils to do these checks
How to use
import GokiLockSDK from '@goki-lock/react-native'
const lockdata = '...'
GokiLockSDK.unlock(lockdata)
.then(() => {
console.log('unlock success')
})
.catch(err => {
console.log('unlock failed', err)
})