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) { switch (resultCode) {
case Activity.RESULT_OK: case Activity.RESULT_OK:
// All required changes were successfully made // All required changes were successfully made
Toast.makeText(MainActivity.this, states.isLocationPresent() + "", Toast.LENGTH_SHORT) Log.v("case 101", states.isLocationPresent() + "");
.show();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
wifiHotspotManager.turnOnHotspot(); wifiHotspotManager.turnOnHotspot();
} }
break; break;
case Activity.RESULT_CANCELED: case Activity.RESULT_CANCELED:
// The user was asked to change settings, but chose not to // 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; break;
default: default:
break; break;

View File

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