manadream / AndroidProxySetter

An android app that sets the proxy settings for a wifi access point by using adb
GNU General Public License v3.0
477 stars 96 forks source link

Failed to run on Android 6.0 #14

Open Carlgege opened 7 years ago

Carlgege commented 7 years ago

I can run this app on Android 4.4 successfully. But, when i run it on Android 6.0, the result is failed and error code is "2". Is it a permission issue?

I update the AndroidManifest.xml with follow permissions and build app again:

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Unfortunately, failed again.

manadream commented 7 years ago

So if you are trying to run this on a 6.0 or higher physical device, it will not work. This is because of a change that was made in 6.0 that does not allow apps to modify wifi configs that it did not create. It will only work on 6.0+ emulators if you install the emulator build variant.

maurjiu commented 7 years ago

Implementation is planned for 6+?

manadream commented 7 years ago

Unfortunately, because of the changes made to the Android OS, the approach used in this app and other Proxy setting apps no longer works. If you are running a 6+ emulator, you can use the emulator build on those devices and it will work.

The reason for the problem is that the proxy setter app cannot modify the system WifiConfiguration objects. From the change doc for Android 6:

Your apps can now change the state of WifiConfiguration objects only if you created these objects. You are not permitted to modify or delete WifiConfiguration objects created by the user or by other apps.

https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html

MahmudulHasan commented 7 years ago

@jpkrause Will there be support for android 6.0+ in near future?

manadream commented 7 years ago

Highly unlikely as I do not know how to work around the issue noted in my comment above.