I created a test wifi hotspot app. The app essentially enables and disables wifi hotspot functionality for the android platform(tested from 2.3 to 4.1).
I've noticed two issues with the app that I'm hoping to get some help with.
1)I'm unable to stop the wifi hotspot if the hotspot has been enabled for more than 30 minutes(average timing). I'm able to stop the hotspot just fine if it hasn't been started for very long. I use the following code to stop:
// Disable wifi hotspot
private static void stopAccessPoint() {
try
{
Method[] wmMethods = wifi.getClass().getDeclaredMethods();
for (Method method : wmMethods) {
if (method.getName().equals("setWifiApEnabled")) {
try {
method.invoke(wifi, null, false);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
catch(Exception e)
{
Log.d(TAG, errorStoppingHotspotMessage);
}
2)The wifi hotspot loses connectivity to the internet after being in use for long periods of time. I noticed that it occurs more frequently when in use around other wireless networks, so I thought maybe it could be due to interference.
I'm able to start the wifi hotspot just fine with no issues at any given time. All research pointed me to the above code that I'm already using for disabling the hotspot.
Have any of you guys seen these issues before? It's really hard to test the issues considering the amount of time it takes for the issues to occur.
Any help will be greatly appreciated.