Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

launching gps setting screen in android

Tags:

android

The following code is launching gps setting screen in samsung device but in htc device it is launching security screen of setting.How can i write code so that it will launch gps screen independent of the devices.Please help is there any alternative solution

final ComponentName toLaunch = new ComponentName("com.android.settings","com.android.settings.SecuritySettings");
            final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            intent.setComponent(toLaunch);
            startActivity(intent);
like image 395
android Avatar asked Feb 02 '26 08:02

android


1 Answers

Get rid of the setComponent() and addCategory() calls and see if that helps. You should not be using those in any case, particularly the ComponentName that hard-wires in invalid package and class names.

like image 110
CommonsWare Avatar answered Feb 04 '26 01:02

CommonsWare