2017-05-06 65 views
0

我正在尝试导航到地理定位设置页面,但是,在我的代码中出现“ACTION_LOCATION_SOURCE_SETTINGS cannot be resolved or is not a field”错误。我已经到处搜索,但找不到任何与我已经完成的任何不同的内容.-我正在运行Android 7.0。我正在运行Android 7.0。有没有其他的方式来做我的android版本?如何在android中打开GPS设置?

+0

试试这个:startActivity(新意图(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) –

+0

同样的错误。我认为它不在我的SDK中 – FatB00b

+0

final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(intent); –

回答

0

我认为你正在使用错误的进口

使用下面的导入和去除前一个

import android.provider.Settings; 

或者你也可以尝试像下面。

Intent settingintent= new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); 
startActivity(settingintent); 
+0

我重新启动了eclipse,它工作。谢谢:)你能回答这个问题吗? http://stackoverflow.com/questions/43796190/how-to-get-device-location – FatB00b

+0

好的,我会检查这个问题也 –

相关问题