android - How can I get in my app when hostspot state changed? -
i have prototype android app listening mobile function state continuously hotspot. bluetooth detect, using registercontentobserver()
latest state , notify me in custom contentobserver
.
so hotspot,
- how can detect hotspot on/off
- check device connected through hotspot or not
thanks in advance.
check if hotspot enabled or not
method method = wifimanager.getclass().getdeclaredmethod("getwifiapstate"); method.setaccessible(true); int actualstate = (integer) method.invoke(wifimanager, (object[]) null);
different states
public static int ap_state_disabling = 10; public static int ap_state_disabled = 11; public static int ap_state_enabling = 12; public static int ap_state_enabled = 13; public static int ap_state_failed = 14;
for detecting clients can use android.net.wifi.wifi_hotspot_clients_changed
broadcast receiver.
This comment has been removed by the author.
ReplyDeleteYou have shared most important information about this topic. Carry on your work.
ReplyDeletewell, if you need app developer so please feel free to knock us.