问题描述
我知道有关于这几个问题,但我没有找到正是我想要的答案。
我打电话getLastKnownLocation的GPS供应商,它的返回null。该文档说,如果没有启用提供商,这可能会发生,但我知道它是。是否有可能为供应商,如果没有最后已知的位置存在返回null?我没有看到的文档说:如果没有最后已知的位置是否存在可能返回null
谢谢!
是的。事实上,大部分的时候,它会返回空
,因为没有什么是导致GPS获得修正。 GPS通常是关机,以节省电池寿命。请参见获取用户位置为配方查找您的位置。
该文件有其缺陷。
I know there's a few questions about this, but I'm not finding exactly the answer I want.
I'm calling getLastKnownLocation for the GPS provider and it's returning null. The docs say this might happen if the provider isn't enabled, but I know it is. Is it possible for the provider to return null if no last known location exists? I don't see where the docs say "may return null if no last known location exists"
Thanks!
Yes. In fact, much of the time, it will return null
, because nothing is causing GPS to acquire fixes. GPS is usually powered down to save on battery life. See Obtaining User Location for the recipe for finding your location.
The documentation has its flaws.
这篇关于安卓getlastknownlocation返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!