title: How to enable GPS in android coding
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4721449/enable-gps-programatically-like-tasker">Enable GPS programatically like Tasker</a>  </p>
  </blockquote>
  
  
  
  <p>Ok, I know there is same question asked before but all answer is "NO". It is proven that enable GPS can be done in coding. Don't believe? try out an application called "LOOKOUT". I believe there is some workaround in order to achieve this.</p>
  
  <p>I had read through lookout AndroidManifest.xml, what i found out they only use </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt;
  </code></pre>
  
  <p>Anyone have idea how they managed to do this? what is the secret behind? I personally managed to do this only if the application is install as system app and also require two permission</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/&gt;
  </code></pre>
  
  <p>My Code:</p>
  
  <pre><code>Settings.Secure.setLocationProviderEnabled(getContentResolver(), LocationManager.GPS_PROVIDER, true);
  </code></pre>
  
  <p>thank you.</p>