Update Android provider.Settings.System value

he saw that I can not write settings in the LG-P500 (Android 2.2). This is my code:

android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.AUTO_TIME, 1); 

A value indicating whether the user prefers to automatically select the date, time and time zone from the network (NITZ). 1 = yes, 0 = no

It works fine in my Android 2.2 emulator. I am also trying to use another phone, HTC Android 2.1, it works fine.

Can anyone know what the problem is? Thank you very much.

+5
source share
1 answer

You must add

<uses-permission android:name="android.permission.WRITE_SETTINGS"></uses-permission>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"></uses-permission>

into your files AndroidManifest.xml.

This should do the trick; -)

+3
source

All Articles