使用Action Settings.ACTION_MANAGE_WRITE_SETTINGS 启动隐式Intent 使用 “package:” + getPackageName() 携带App的包名信息 使用 Settings.System.canWrite 方法检测授权结果 private static final int REQUEST_CODE_WRITE_SET
private static final int REQUEST_CODE_WRITE_SETTINGS = 2; private void requestWriteSettings() { Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS); intent.setData(Uri.parse("package:" + getPackageName())); startActivityForResult(intent, REQUEST_CODE_WRITE_SETTINGS); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_WRITE_SETTINGS) { if (Settings.System.canWrite(this)) { Log.i(LOGTAG, "onActivityResult write settings granted"); } } }