Google地方信息会返回60个项目,间隔为2秒 [英] Google Places returns 60 items with 2s interval

查看:98
本文介绍了Google地方信息会返回60个项目,间隔为2秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个分页,但现在显示了20个位置,然后等待2秒,再显示另外20个位置,并再次等待几秒钟。我读到Google在nextPage调用之间增加了延迟。如果有办法消除这种延迟并且一次显示60个地方,我就会发现它。

I added a pagination, but now it shows 20 places then waits 2s, shows another 20 places and waits again couple sec. I read that Google adds a delay in between nextPage calls. I wounder if there is a way to remove that delay and show 60 places all in once

this.service.search(request, function(results, status, pagination) {
            self.addPlaces(results, status, pagination);

            if (pagination.hasNextPage) {
                // sleep:0; this doesn't effect anything
                pagination.nextPage();
            }                           
});


推荐答案

无法消除延迟,周转时会向用户显示progressBar或在向用户显示之前预取。您可以看到我的答案,我使用AsyncTask在后台调用请求方法并显示progressBar,直到它获取所有60个结果。

There is no way to remove that delay, but a turnaround would be displaying a progressBar to the users or pre-fetching before showing it to the users. You can see my answer, I am using AsyncTask to call the request method at the background and displaying a progressBar till it fetches all the 60 results.

这篇关于Google地方信息会返回60个项目,间隔为2秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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