当前位置: 动力学知识库 > 问答 > 编程问答 >

android - I get an error on calling Locations Manager requestSingleUpdate

问题描述:

I am implementing the code from "A deep dive into location" and the last line at the following code produces an error:

if (locationListener != null && (bestTime < minTime || bestAccuracy > minDistance)) {

IntentFilter locIntentFilter = new IntentFilter(SINGLE_LOCATION_UPDATE_ACTION);

context.registerReceiver(singleUpdateReceiver, locIntentFilter);

locationManager.requestSingleUpdate(criteria, singleUpatePI);

It seems that requestSingleUpdate is not defined for LocationManager although it is in the sample code and I have seen people saying they've implemented this code.

网友答案:

I have found an answer on a similar question here: http://stackoverflow.com/a/5469101/1285338

This API exists from API level 9 and on

分享给朋友:
您可能感兴趣的文章:
随机阅读: