android - How to enable GPS automatically -


i using code security exception.

private void turngpson(){     string provider = settings.secure.getstring(getcontentresolver(), settings.secure.location_providers_allowed); if(!provider.contains("gps")){ //if gps disabled     final intent poke = new intent();     poke.setclassname("com.android.settings", "com.android.settings.widget.settingsappwidgetprovider");      poke.addcategory(intent.category_alternative);     poke.setdata(uri.parse("3"));      sendbroadcast(poke); } }  private void turngpsoff(){     string provider = settings.secure.getstring(getcontentresolver(), settings.secure.location_providers_allowed);  if(provider.contains("gps")){ //if gps enabled     final intent poke = new intent();     poke.setclassname("com.android.settings", "com.android.settings.widget.settingsappwidgetprovider");     poke.addcategory(intent.category_alternative);     poke.setdata(uri.parse("3"));      sendbroadcast(poke); } } 

how fix problem automatic enable gps.

for security purpose google developer has block above both methods working fine. cant enable gps programatically


Comments

Popular posts from this blog

amazon web services - S3 and apache mod_proxy with basic authentication -

How to install ruby on rails -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -