안드로이드 6.0의 ConnectivityManager.requestNetwork
2019. 5. 3. 18:21ㆍPrograming/Debugging
https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
[Using]
ConnectivityManager.requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback)
[Problem]
Permission Error about WRITE_SETTINGS and CHANGE_NETWORK_STATE
But we can't take the permission via requestPermissions()
[Solution]
Add below code into MainActivity
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS);
intent.setData(Uri.parse("package:" + mContext.getPackageName()));
startActivity(intent);
- Allow modify system settings
- 권한 허용