在android中启动gps设置屏幕

and*_*oid 3 android

下面的代码是在三星设备中启动gps设置屏幕,但是在htc设备中它正在启动设置的安全屏幕.如何编写代码以便它将启动独立于设备的gps屏幕.请帮助是否有任何替代解决方案

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);
Run Code Online (Sandbox Code Playgroud)

Com*_*are 5

摆脱setComponent()和addCategory()调用,看看是否有帮助.在任何情况下都不应该使用它们,尤其是ComponentName无效包和类名中的硬连线.