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-sdk 23 need permission ACCESS_COARSE_LOCATION #110

Open
ytfhwfnh opened this issue Apr 18, 2017 · 3 comments
Open

android-sdk 23 need permission ACCESS_COARSE_LOCATION #110

ytfhwfnh opened this issue Apr 18, 2017 · 3 comments

Comments

@ytfhwfnh
Copy link

when you use getScanResults() method to get wifi list with android 6.0, you need permission ACCESS_COARSE_LOCATION.

@ytfhwfnh
Copy link
Author

ytfhwfnh commented Apr 18, 2017

In my ionic2 project:

AndroidManifest.xml I used:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

project.properties I used:
target=android-23

I can permit ACCESS_COARSE_LOCATION.

No authorization dialog box is displayed in other cases.

@chr4ss1
Copy link

chr4ss1 commented May 5, 2017

For Android6.0(SDK >= 23), they have changed the permissions model, now you have to ask permissions manually inside the app as far I know - uses-permission doesn't do anything.

As far I understand, the reason why it works is that you're compiling against targetSdkVersion="22" (Android <= 5.1) which has backwards compability with newer androids as well. If you use that SDK version, your app will have those permissions by default.

You can get the same effect if you add this line to config.xml:

<preference name="android-targetSdkVersion" value="22"/>

@adhambadr
Copy link

adhambadr commented Jun 16, 2017

for newer versions of Android just use this plugin https://github.com/NeoLSN/cordova-plugin-android-permissions , request / check for the ACCESS_COARSE / FINE permission & in the success callback start the scan. It worked for me @ SDK 25

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

3 participants