android

时间:2015-08-12 15:50:52

标签: android timertask sleep-mode

我构建应用程序,使用service和broadcastreceiver.i将服务器的位置更新提供给后台服务器。运行定位方法(运行每X分钟)运行location.it的方法包括fatch lattitude,经度和使用API​​调用更新到服务器。 我有一个问题和问题。有一个清单。

1.当设备处于待机模式或睡眠模式时,我的计时器进入休眠状态

2.i如果用户的最后位置和当前位置距离为500米或更长,则必须更新位置。

3.我想知道进入睡眠模式的分钟或秒针装置有多少?

4.my计时器在运行devoce模式下运行,而不是为什么在设备睡眠模式下停止或睡眠?

我的时间任务

     class TimeDisplayTimerTask extends TimerTask {

            @Override
            public void run() {
                // run on another thread
                mHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        location();
                        notifyUser2();

                        Log.d("timeeeeeeee22222222", "time22222222");
                        // display toast

                    }

                });
            }

//in  oncreate
  if (mTimer != null) {
            mTimer.cancel();
        } else {
            // recreate new
            mTimer = new Timer();
        }
        // schedule task
        mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(), 0, NOTIFY_INTERVAL);

计时器的当前运行方式是什么?如果是,为什么它在设备处于待机模式或睡眠模式时睡眠?

帮帮我搜索了很多网站,但无法获得。 提前致谢

0 个答案:

没有答案
相关问题