How to use the react-native-ble-manager.enableBluetooth function in react-native-ble-manager

To help you get started, we’ve selected a few react-native-ble-manager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anchetaWern / RNFaceAttendance / App.js View on Github external
constructor(props) {
    super(props);

    this.peripherals = [];

    BleManager.enableBluetooth()
      .then(() => {
        console.log('Bluetooth is already enabled');
      })
      .catch((error) => {
        Alert.alert('Enable bluetooth', 'You need to enable bluetooth to use this app.');
      });

    BleManager.start({showAlert: false})
      .then(() => {
        console.log('Module initialized');
      });

    if (Platform.OS === 'android' && Platform.Version >= 23) {
      PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => {
        if(!result){
          PermissionsAndroid.requestPermission(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => {
github zhanguangao / react-native-ble-manager-demo / src / BleModule.js View on Github external
enableBluetooth() {
	    BleManager.enableBluetooth()
		    .then(() => {
			    console.log('The bluetooh is already enabled or the user confirm');
		    })
		    .catch((error) => {
			    console.log('The user refuse to enable bluetooth');
		    });
    }
github zhanguangao / react-native-ble-manager-demo / demo for v3.2.1 deprecated / app / BleManager.js View on Github external
enableBluetooth() {
	    BleManager.enableBluetooth()
		    .then(() => {
			    console.log('The bluetooh is already enabled or the user confirm');
		    })
		    .catch((error) => {
			    console.log('The user refuse to enable bluetooth');
		    });
    }