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.
How to change WifiConfigration in Oreo device
Asked Answered
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)" –
Afflux
Method getConfigMethod = manager.getClass().getMethod("getWifiApConfiguration");
works below the oreo version only –
Afflux @Afflux 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 –
Tagmeme
how can i define my app as system app? –
Afflux
It can only possible if you are having configuration pemx509 and pk8 files to sign your apk –
Tagmeme
configuration pemx509 and pk8 files ? What does it actually means and How can I get this ? –
Meganmeganthropus
@Meganmeganthropus you can only do all this if your app is a system app, an app can only be a system app if it is placed on the ROM, and from the ROM vendor you can get this keys. –
Tagmeme
© 2022 - 2024 — McMap. All rights reserved.