I'm using android N and I'm trying to turn on wifi hotspot when the user opens the application. I was able to turn on the hotspot using the code that I mentioned below but other mobiles are not able to connect to this network, they stuck at Obtaining IP address.
Functionality
public void changeStateWifiAp(boolean activated) {
Method method;
try {
method = wifiManager.getClass().getDeclaredMethod("setWifiApEnabled", WifiConfiguration.class, Boolean.TYPE);
method.invoke(wifiManager, wifiConfiguration, activated);
} catch (Exception e) {
e.printStackTrace();
}
}