2017-05-06 62 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

好的,我會檢查這個問題也 –

相關問題