Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 6 Compatibility #15

Open
app2one opened this issue Jul 23, 2016 · 13 comments
Open

Android 6 Compatibility #15

app2one opened this issue Jul 23, 2016 · 13 comments

Comments

@app2one
Copy link

app2one commented Jul 23, 2016

The module currently doesn't work on android 6. It seems start from android 6 additional permission is required on runtime bluetooth usage. Is anyone come up with any idea?

@mmazzarolo
Copy link
Owner

Hi!
Thanks for the info! I'm on holyday right now, I'll take a look at it in 7 days :)

@alessandro-bottamedi
Copy link

alessandro-bottamedi commented Jul 23, 2016

@mmazzarolo
Copy link
Owner

@alessandro-bottamedi Thanks, did you already worked with that module? Is it stable?
Also, other info on Android M permissions on RN

@app2one
Copy link
Author

app2one commented Jul 29, 2016

Yes. That module works. Thanks.

從我的 iPhone 傳送

Matteo Mazzarolo [email protected] 於 2016年7月29日 20:54 寫道:

@alessandro-bottamedi Thanks, did you already worked with that module? Is it stable?
Also, other info on Android M permissions on RN


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@alessandro-bottamedi
Copy link

alessandro-bottamedi commented Jul 29, 2016

@mmazzarolo
It seems stable, Next week I will release an app in beta testing with this Android Permissions module, I'll let you know...

@alessandro-bottamedi
Copy link

alessandro-bottamedi commented Aug 7, 2016

Here's what I think I understand:

In android 6.0 there are two different levels of permission: NORMAL and DANGEROUS.
For the NORMAL permission is sufficient to place them in the android manifest, while the DANGEROUS must have the permissions at runtime.

to detect beacons you must have bluetooth and localization active and accepted this permissions (I'm right??):

android.permission.BLUETOOTH and android.permission. BLUETOOTH_ADMIN are in NORMAL level so it need to be only in the android.manifest.
ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION are DANGEROUS levels so it need the new android 6.0 runtime permission.

Here the list of permissions with its levels: https://developer.android.com/reference/android/Manifest.permission.html

To make everything work i've used this: react-native-permissions i've discarded react-native-android-permissions because this not have iOs support.

And i ask only for location permission in runtime it is sufficent for detecting ibeacon.

I'm working now to make the right procedure to check if the app have permission on android and iOs, and check the geolocation and bluetooth state...

Please correct me if i'm wrong

@mmazzarolo
Copy link
Owner

Thank you Alessandro (sei italiano anche tu, giusto?),
it seems you're correct, if you're interested you can also check the altbeacons SDK for android documentation about the Marshmellow permissions.
From your understanding do you thing it would be possibile to handle the runtime permission from react-native-beacons-android itself instead of forcing the user to use another external dependency?
The cleanest solution in my opinion should be adding the feature in react-native but it doesn't seem to be in its roadmap.

And thank you again for your time man 👍

@alessandro-bottamedi
Copy link

(Si italiano, lo hai capito dal mio pessimo inglese o dal nome? 😉 )

The Estimote-Android-SDK docs has much more clear explanation:

In order to reliably detect beacons following conditions must be met:

  • Bluetooth permissions are granted (android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN). This is done automatically if you use Estimote SDK. BeaconService is declared in AndroidManifest.xml. This is done automatically if you use Estimate SDK.
  • If running on Android M or later, Location Services must be turned on.
  • If running on Android M or later and your app is targeting SDK < 23 (M), any location permission (ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION) must be granted for background beacon detection.
  • If running on Android M or later and your app is targeting SDK >= 23 (M), any location permission (ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION must be granted.

Maybe you can insert an explanation like this in the README and the link for these Permissions Packages...

Anyway i think that the Permissions Package must be separated from the others, so you can use it more times in your app for all your permissions needs. But its only my opinion.
Preferably it should be insert in react-native of course!

@mmazzarolo
Copy link
Owner

(Si italiano, lo hai capito dal mio pessimo inglese o dal nome? 😉 )

Dal nome, sono l'ultimo che può criticare l'inglese di qualcuno visto il mio, tranquillo!

Maybe you can insert an explanation like this in the README and the link for these Permissions Packages...

Yup, gimme two sec

@mmazzarolo
Copy link
Owner

Done! Closing this issue while waiting for an official solution, thanks @app2one and @alessandro-bottamedi for pointing out this issue.

Feel free to post here if needed 👍

@micheletedeschi
Copy link

FYI now react native (0.33.0) support android M permission!

@mmazzarolo
Copy link
Owner

@micheletedeschi Unexpected, nice!
Did you already try it? Any hint on the implementation of it on react-native-beacons-android? Thanks!

@mmazzarolo mmazzarolo reopened this Sep 12, 2016
@micheletedeschi
Copy link

micheletedeschi commented Sep 12, 2016

Yes and works! Only be sure to ask permission before start ranging or monitoring.

You can find a permission example here: https://github.com/facebook/react-native/blob/0fb2ccfcc3e6babe28d7d1bcf4635ef2f9191eb1/Examples/UIExplorer/js/PermissionsExampleAndroid.android.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants