I used https://github.com/aegis1980/WifiHotSpot code to start and stop Hotspot from my application. But it will only start and stop the hotspot that cannot change the Wifi configuration, I also want to change the SSID and password. I know how to do that thing under the Oreo device. Can anyone help me get the same result in Oreo.
ONLY POSSIBLE IF YOUR APP IS RUNNING AS SYSTEM APP
In that case, I'm able to do this by using the below class:
https://github.com/anujjpandey/HotSpotOnOreo/blob/master/WifiAndDataConfigs.java
You can use the same
-
it's not working it throw exception "java.lang.SecurityException: App not allowed to read or update stored WiFi AP config (uid = 10495)" – MJM Feb 6 '19 at 5:51
-
Method getConfigMethod = manager.getClass().getMethod("getWifiApConfiguration");
works below the oreo version only – MJM Feb 6 '19 at 9:22 -
@MJM indeed it's need some permissions <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS"></uses-permission> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> <permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" android:protectionLevel="signature|privileged" /> It's working for me on system app – Anuj J Pandey Feb 6 '19 at 13:32
-
-
It can only possible if you are having configuration pemx509 and pk8 files to sign your apk – Anuj J Pandey Feb 11 '19 at 7:21