title: Turn On Off GPS in ICS
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10302894/ics-android-enable-gps-programmatically-closed-using-an-alternative-approach">ICS Android enable gps programmatically? [closed using an alternative approach]</a>  </p>
  </blockquote>
  
  
  
  <p>I was using the code below to enable and disable GPS programmatically and worked perfectly in 2.2 and 2.3.</p>
  
  <pre><code>Intent i = new Intent();
  i.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); 
  i.addCategory(Intent.CATEGORY_ALTERNATIVE);
  i.setData(Uri.parse("3"));     
  context.sendBroadcast(i);
  </code></pre>
  
  <p>However, when trying to use the ICS (4.0) realized it did not work. Then I discovered that it was a bug as link below.
  <a href="http://code.google.com/p/android/issues/detail?id=7890" rel="nofollow noreferrer">http://code.google.com/p/android/issues/detail?id=7890</a></p>
  
  <p>I believe we have fixed in ICS.</p>
  
  <p>Could anyone tell me if there is an alternative to solve this in ICS?</p>
  
  <p>I think an OS ridiculous "open source" have so many restrictions. I'm already starting to regret having opted to develop our applications on Android.</p>