hoerresb / WifiWizard

A Cordova plugin for managing Wifi networks
Apache License 2.0
205 stars 177 forks source link

Missing permissions on Marshmallow (api level 23) for getScanResults #49

Open jeffcharles opened 8 years ago

jeffcharles commented 8 years ago

Targeting API level 23 on Android requires ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION to retrieve scan results

hoerresb commented 8 years ago

Thanks for bringing this to our attention. We will get that updated shortly.

jeffcharles commented 8 years ago

The other thing I'm noticing is that the new runtime permissions model is causing an issue in that we don't have a great way of doing the check/request for permissions that Marshmallow requires. I guess it would be helpful if we could do the runtime check/request in a separate method so we have more control over the UX.

hoerresb commented 8 years ago

I've added ACCESS_COARSE_LOCATION in the most recent update. I will look into ways of doing a check/request permissions. Thanks

Vincent-Noben commented 8 years ago

I think I have the same or a related problem. First I do the startScan function and it's succes callback fires. After a few seconds I manually run the getScanResults function with a button, but that always gives me an empty array, although enough wifi signals are present nearby. Might this be related to permissions problem mentiond in this issue?

Working with CyanogenOS 13 (Marshmallow) on my Oneplus One

EDIT: The androidmanifest.xml looks like this. So Permissions seem to be set correctly?

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="be.vincentnoben.wifimap" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
</manifest>
jimcortez commented 8 years ago

I created PR #77 that addresses this issue. It uses the compat cordova library to request the permission if it does not exist.