MacKentoch / react-native-beacons-manager

React-Native library for detecting beacons (iOS and Android)
MIT License
582 stars 316 forks source link

Application is closed when is called the "startRangingBeaconsInRegion" #166

Open GiacomoMasi opened 5 years ago

GiacomoMasi commented 5 years ago

Version

1.0.7

Platform

iOS | Android

OS version

iOS 10| android 7.0...

Steps to reproduce

I have this code in the ComponentDidMount:

componentDidMount() { Beacons.detectIBeacons(); const uuid = this.state.uuidRef; Beacons.startRangingBeaconsInRegion('REGION1', uuid) .then(() => console.log('Beacons ranging started succesfully')) .catch(error => console.log('Beacons ranging not started, error: ${error}'), ); }

Expected behavior

The application scans all beacons in the area.

Actual behavior

When I run the project, the app is installed on the device but when the app is launced, in a few seconds it is closed, I don't understand why.

rhyek commented 4 years ago

I also have this problem. No error message whatsoever.

Hassam34 commented 4 years ago

@GiacomoMasi @rhyek do you find solution for this issue ? As i am facing the same situation

rhyek commented 4 years ago

@Hassam34, look at #154.

hadpro24 commented 4 years ago

I have the same problem, android.

my code:

const region = Platform.select({
      ios: {
        identifier: 'nameid',
        uuid: 'uuid'
      },
      android: {
        regionId: 'nameid',
        beaconsUUID: 'uuid',
      }
   })
   console.log('choice ', region)
    // Request for authorization while the app is open
    // Tells the library to detect iBeacons
    Beacons.detectIBeacons()

    // Start detecting all iBeacons in the nearby
    try {
      await Beacons.startRangingBeaconsInRegion(region)
      console.log(`Beacons ranging started succesfully!`)
    } catch(err) {
      console.log(`Beacons ranging not started, error: `, err)
    }

    // Print a log of the detected iBeacons (1 per second)
    DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
      console.log('Found beacons!', data.beacons)
    })