K
K
Keppp2021-05-24 15:29:30
iOS
Keppp, 2021-05-24 15:29:30

How to check bluetooth status?

import React, {useEffect} from 'react';
import {NativeModules, View } from 'react-native';

const BleComponent = () => {
       useEffect(() => {
             NativeModules.RNBluetoothManager.getBluetoothState().then(i => console.log(i));
       },  []);

       return <View />
};

When executing this code on Android, True / False is returned, on IOS it returns an error that the getBluetoothState method is undefined.

Added to info.plist:
- Privacy - Bluetooth Always Usage Description (string)
- Privacy - Bluetooth Peripheral Usage Description (string)

Why is this possible?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question