I want to develop an android app(using java in android studio) like this https://play.google.com/store/apps/details?id=com.gibatekpro.force4gltemodeonly&hl=en . But the problem I am encountering is that I don't know how to open these settings programmatically. These are mobile settings so there should be an Intent for this. I hope I have explained my problem well. Any help will be appreciated.
Asked
Active
Viewed 82 times
0
-
https://stackoverflow.com/a/6789616/5339146 this can help you to start. – Mihodi Lushan Aug 08 '20 at 08:44
1 Answers
0
Its an example of opening GPS setting hope you get some help from it
//Declared as class level constant
public static final int GPS_REQUEST_CODE = 9003;
//Intent wherever you want to set it
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(intent, GPS_REQUEST_CODE);
//In On Activity Results
if (requestCode == GPS_REQUEST_CODE) {
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
boolean providerEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (providerEnabled) {
Toast.makeText(this, "GPS is enabled", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "GPS not enabled. Unable to show user location", Toast.LENGTH_SHORT).show();
}
}

Shivam Singh
- 157
- 1
- 10