android GPS enable progrmmatically
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4721449/enable-gps-programatically-like-tasker">Enable GPS programatically like Tasker</a>  </p>
</blockquote>



<p>I want to get latitude and longitude programmatic in android app. But it depended upon whether the GPS is enabled or not. I used to check the GPS with this code</p>

<pre><code>   LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    {
    if(!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER )) 
    { 
    Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS );
    startActivity(myIntent);
    }
    }
</code></pre>

<p>But it basically shows the screen to enable it. But i dont want that user should enable it. It should enable automatically  if the gps is disabled. </p>

<p>Any sample code would be appreciated.</p>
