I'm new to android.
I want to receive information via broadcastreceiver
(onReceive
) to know that if user enable/disable "Portable Wi-Fi Hotspot"
(Settings->Wireless &Networks->Tethering & portable hotspot)
.
Check this link
And I found that there is "android.net.wifi.WIFI_AP_STATE_CHANGED
" but it was set to hidden. Any how I can use that ???
Thanks in advance
Hii #user802467 there is answer to your question asked in comment at this link : How to get wifi hotspot state. Values are between 10-13 because of version 4 and above. You can easily get the actual state as explained in the link.
to receive enable/disable "Portable Wi-Fi Hotspot" events you will need to register an Receiver for WIFI_AP_STATE_CHANGED as :
inside BroadcastReceiver onReceive we can extract wifi Hotspot state using
wifi_state
as :you can do same by declaring Receiver in AndroidManifest for
android.net.wifi.WIFI_AP_STATE_CHANGED
action and also include all necessary wifi permissions inAndroidManifest.xml
EDIT :
Add receiver in AndroidManifest as :
you can see this example for more help