I want to make user to redirect to developer option-> mock location when it has been enabled. My requirement is, when there is any fake gps location tracked, I need to redirect to developer option-> Select mock location app to disable.
if (AppUtils.isMockLocationEnabled(mLastLocation, FeedbackActivity.this)) {
final Dialog dialog = new Dialog(FeedbackActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_alert_response_accepted1);
Button ok = (Button) dialog.findViewById(R.id.ok_button);
TextView textView = (TextView) dialog.findViewById(R.id.response);
textView.setText("Turn off Fake Gps");
Button cancel = (Button) dialog.findViewById(R.id.Cancel_button);
dialog.setCancelable(false);
dialog.show();
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
//I tried this but this is not working..
Settings.Secure.getString(getContentResolver(), "mock_location");
}
});
}
I tried this "mock_location" but it's not going to select mock location app. nothing is performing..
//this below is just opening only developer option. How to redirect to mock location in developer settings to turn off?
startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS));