启动GPS在Android的设置画面 [英] launching gps setting screen in android

查看:131
本文介绍了启动GPS在Android的设置画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面code推出GPS三星设备设置屏幕,但在HTC的设备,它推出安全光幕setting.How我可以写code,使其将推出GPS屏幕独立devices.Please的帮助有任何替代解决方案

 最后组件名toLaunch =新的组件名(com.android.settings,com.android.settings.SecuritySettings);
            最终意向意图=新的意图(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            intent.setComponent(toLaunch);
            startActivity(意向);
 

解决方案

摆脱 setComponent() addCategory()电话,看看有没有什么帮助。你不应该使用这些在任何情况下,特别是组件名的硬导线无效的包和类名。

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);

解决方案

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.

这篇关于启动GPS在Android的设置画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆