setFastestInterval(长milis)不工作 [英] setFastestInterval(long milis) not working

查看:805
本文介绍了setFastestInterval(长milis)不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,只要我得到了一个位置precise足够满足我的需求减缓更新率:

I want to slow the update rates as soon as I got a location precise enough for my needs:

    @Override
public void slowUpdateRate() {
    /*
     * Set the update interval 
     */
    Dbg.v(TAG,"****************************");
    Dbg.e(TAG, "-- SLOW update rate");
    Dbg.v(TAG,"****************************");
    stopUpdates();
    mLocationRequest.setInterval(1500000);
    mLocationRequest.setFastestInterval(150000);
    mLocationClient.requestLocationUpdates(mLocationRequest, this);

该方法被调用,但我仍然有每3秒半的更新。我有一个ViewPager用地图2.0片段,但我没有 mapFragment.getMap()setMyLocationEnabled(假);

我如何更新速度慢?为什么FastestInterval不工作?

How do I slow updates? Why FastestInterval is not working?

编辑:我测试他们对谷歌文档提供的虚拟应用我的更新速度慢,它工作正常。我加了LogCat中getFastestInterval和getInterval,我得到了15至30秒,我在测试环境期待。但更新速度还是吓坏太高。

I test my slow updates on the dummy application provided by Google docs and it works ok. I added a LogCat getFastestInterval and getInterval and I got the 15 and 30 seconds I was expecting in the test context. BUT the update rate is still freaking too high.

推荐答案

我得到这个!

这个错误是我的,可以在这个简历

The mistake is mine and can be resume in this

DO 不会再次调用 mLocationClient.requestUpdates(mLocationRequest,这一点);

此外,请记住,默认最快的时间间隔为您的正常间隔/ 6。

Also, remember that the default fastest interval is your normal interval/6 .

这篇关于setFastestInterval(长milis)不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆