相关疑难解决方法(0)

当屏幕指示灯熄灭时,LocationClient不会回调,但我的WakefulThread正如预期的那样完美运行

为了在后台检索融合位置,我创建了一个与Commonsguy创建的cwac -locpoll库非常相似的库.

在PollerThread内部,我正在尝试使用连接,请求和检索位置LocationClient.

我可以通过接收onConnected方法的回调来连接,但是我无法在方法上获得回调.因此onLocationChanged我的onTimeout线程按照确定的间隔执行.

注意: 此问题仅在屏幕指示灯熄灭时发生.否则它完全正常.

我怀疑新的位置Api可能存在错误.

这是我的实施PollerThread,

          private class PollerThread extends WakefulThread  implements GooglePlayServicesClient.ConnectionCallbacks,
      GooglePlayServicesClient.OnConnectionFailedListener,LocationListener{

            private static final String TAG = "PollerThread";

            //context
            private Context mContext=null;
            private LocationClient mLocationClient=null;
            private LocationRequest mLocationRequest=null;
            private LocationManager locMgr=null;
            private Intent intentTemplate=null;
            private Handler handler=new Handler();
            private Runnable onTimeout = new Runnable() {

            @Override
            public void run() {

            Log.e(TAG, "onTimeout");

            //prepare broadcast intent
              Intent toBroadcast=new Intent(intentTemplate);
              toBroadcast.putExtra(FusedPoller.EXTRA_ERROR, "Timeout!"); …
Run Code Online (Sandbox Code Playgroud)

android locationlistener android-location

6
推荐指数
1
解决办法
6787
查看次数