Hi, all. I need to enable\disable gps programmatically. I used code String provider = Settings.Secure.getString(QtApplication.mainActivity().getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if(!provider.contains("gps")){ //if gps is disabled final Intent poke = new Intent(); poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); //$NON- NLS-1$//$NON-NLS-2$ poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse("3")); //$NON-NLS-1$ sendBroadcast(poke); } but this, not work. or this code Settings.Secure.setLocationProviderEnabled(QtApplication.mainActivity().getContentResolver(),"gps",true); but this return exception Writing exception to parcel java.lang.SecurityException: Permission Denial: writing com.android.providers.settings.SettingsProvider uri content://settings/secure from pid=29196, uid=10067 requires android.permission.WRITE_SETTINGS i added <uses-permission android:name="android.permission.WRITE_SETTINGS"> in AndroidManifest.xml but still the exception. What wrong ? P.S. Sorry for my English :) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en