I want to show the connection process on the screen when my device is connecting to the wifi network. SUPPLICANT_STATE_CHANGED_ACTION is provided by WifiManager but i don't know how to use it. Can anyone help me please?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I don't know of a callback method that lets you know when the wifi status has changed. I polled the information using a Handler running in the background.
Add the handler to your class.
Start it by calling
The code I used is below.
You can indeed use the broadcasted intents for
SUPPLICANT_STATE_CHANGED_ACTION
:The app needs the permission in its Manifest file:
Then register for the system broadcast:
the
registerReceiver()
needs an instance of a class implementingBroadcastReceiver
as its first argument. In that code you can act on the Wifi state changes by overriding theonReceive
method. For exampleFor the possible Wifi state values, see http://developer.android.com/reference/android/net/wifi/SupplicantState.html