2017-11-17 7 views
1

上の任意のビーコンを示していないが、しかし、Android上で、ビーコン配列は、(それに何も現れあります私の隣に6つのビーコンがあり、それらはすべてiOSに表示されます)。ここで反応し、ネイティブ・ビーコン・マネージャーのiOS上で素敵な作品<p><a href="https://github.com/MacKentoch/react-native-beacons-manager" rel="nofollow noreferrer">https://github.com/MacKentoch/react-native-beacons-manager</a></p> を使用してAndroidの

は私がやっているものです:私のコンソールで

componentDidMount() { 

// Start detecting all iBeacons in the nearby 
Beacons.detectIBeacons(); 

Beacons.startRangingBeaconsInRegion('Estimotes', 'B9407F30-F5F8-466E-AFF9-25556B57FE6D').then((data)=>{ 

    console.log(data); 

}).catch((reason) => { 

    console.log(reason); 


}); 


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

    console.log(data); 

}); 

} 

を、私はこれを取得:

{beacons: Array(0), uuid: "b9407f30-f5f8-466e-aff9-25556b57fe6d", identifier: "Estimotes"} 

これは動作するはずですので、私はデフォルトとしてEstimotesのUUIDを残しました。テスト用にSamsung Galaxy S8 +を使用する。ここで間違ったコーディングをしていますか?私が紛失しているAndroidに追加の権限がありますか? Bluetoothとロケーションサービスがオンになっています。

答えて

0

申し訳ありませんが、私はそれを理解しました。 Androidの新しいバージョンでは、追加の権限が必要です。あなたのマニフェストでは、そこにこの男を投げる:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 

を....あなたが反応するネイティブ・kontaktioを(IMO反応するネイティブ・ビーコン・マネージャーよりも優れている)を使用している場合にも必要になります<application>セクションで、あなたのマニフェストでこれをスローする:

<service android:name="com.kontakt.sdk.android.ble.service.ProximityService"/> 

は、その後、あなたのapp.jsであなたは(のような許可を要求する必要があります)あなた

import PermissionsAndroid 
from 'react-native' 

を確認してください。

componentDidMount() { 

    try { 
     const granted = PermissionsAndroid.request(
     PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, 
      { 
       'title': 'Location Permission', 
       'message': 'Activeev needs to access your location.' 
      } 
     ) 
     console.log('here', granted); 
     if (granted === PermissionsAndroid.RESULTS.GRANTED) { 
      console.log("Location Permitted") 
     } else { 
      console.log("Location permission denied") 
     } 
    } catch (err) { 
     console.warn(err) 
    } 
} 

魅力的なようになりました。これが他の人に役立つことを願っています

関連する問題

 関連する問題