I\'ve tried to register a Wifi BroadcastReceiver to get the wifi state when it changes. But so far I have no luck receiving the broadcast.
If your Target android version is more than Android O. if you declare receivers in manifest they wont work. So you need to register inside your activity.
Note: If your app targets API level 26 or higher, you cannot use the manifest to declare a receiver for implicit broadcasts (broadcasts that do not target your app specifically), except for a few implicit broadcasts that are exempted from that restriction. In most cases, you can use scheduled jobs instead.
Resource: https://developer.android.com/guide/components/broadcasts