Pablo Perotti
Pablo Perotti

Reputation: 11

Settings management from code

I just want to ask you if you anyone knows how to change the Setting available in:

Settings->Wireless Settings->Mobile Network from code or

Setting: Settings->Wireless Settings->Mobile Network Settings->Network
operators->Select Automatically?

I had been unable to find a property that match this setting in the

Settings.System / Settings.Secure classes.

Is there any alternative way to "turn on/off" the MOBILE connectivity ?

The reason I need to solve this is to workaround the bug occur during transitioning from WIFI to MOBILE that do not enable CELL data automatically.

Upvotes: 1

Views: 1231

Answers (1)

Samuh
Samuh

Reputation: 36484

I think support for this sort of thing(changing settings from code) was removed/deprecated in the newer versions of the SDK; it is not advisable. What I've said is based on Dan Morill's Blog titled: Future Proofing your Android Apps

Eitherways, generally, you would write:

Settings.System.putString(getContentResolver(), <Settings.System.CONST>, <value>);

and have the following permission in your maifest: android.permission.WRITE_SETTINGS The List of Settings.System.CONST can be found in the official documentation: see here

Upvotes: 1

Related Questions