Intent intent = new Intent().setAction(ConnectivityManager.CONNECTIVITY_ACTION);
sendBroadcast(intent);
Exception:
java.lang.RuntimeException: Unable to start activity ComponentInfo{Activity_Index}:
java.lang.SecurityException: Permission Denial: not allowed to send broadcast
android.net.conn.CONNECTIVITY_CHANGE from pid=19360, uid=10052
Manifest permissions:
<!-- Connectivity Manager -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<!-- Connectivity Manager -->
<!-- WIFI -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- WIFI -->
You are not allowed to send this broadcast. If applications could send this broadcast then this could cause problems on the device. This is a protected system broadcast.
Please approach your problem in a different way.
Refer: http://developer.android.com/reference/android/net/ConnectivityManager.html
Notice how there are only a few methods that use that action. This implies you cannot send this broadcast.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With