title: "Automatic date&time" set on/off programmatically
body: <p>I need to set current date &amp; time from network provider or gps provider,
  I have tried this but not worked </p>
  
  <pre><code>String timeSettings = android.provider.Settings.System.getString(
              this.getContentResolver(),
              android.provider.Settings.System.AUTO_TIME);
      if (timeSettings.contentEquals("0")) {
          android.provider.Settings.System.putString(
                  this.getContentResolver(),
                  android.provider.Settings.System.AUTO_TIME, "1");
      }
      timeSettings = android.provider.Settings.System.getString(
              this.getContentResolver(),
              android.provider.Settings.System.AUTO_TIME);
  </code></pre>
  
  <p>And permission</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt;
  </code></pre>
  
  <p>But not working, Please tell what is going wrong and please tell if have any other solution</p>