Remove WRITE_SETTINGS permission for devices>=O

This commit is contained in:
Adeel Zafar 2019-06-27 20:46:42 +05:00
parent 7fb1aa8fad
commit e4e333ae21
2 changed files with 5 additions and 4 deletions

View File

@ -1792,15 +1792,15 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
switch (resultCode) {
case Activity.RESULT_OK:
// All required changes were successfully made
Toast.makeText(MainActivity.this, states.isLocationPresent() + "", Toast.LENGTH_SHORT)
.show();
Log.v("case 101", states.isLocationPresent() + "");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
wifiHotspotManager.turnOnHotspot();
}
break;
case Activity.RESULT_CANCELED:
// The user was asked to change settings, but chose not to
Toast.makeText(MainActivity.this, "Canceled", Toast.LENGTH_SHORT).show();
Log.v("case 101", "Canceled");
break;
default:
break;

View File

@ -39,7 +39,8 @@ public class WifiHotspotManager {
//To get write permission settings, we use this method.
public void showWritePermissionSettings() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
if (!Settings.System.canWrite(this.context)) {
Log.v("DANG", " " + !Settings.System.canWrite(this.context));
Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_WRITE_SETTINGS);