对于使用 ACCESS_COARSE_LOCATION 权限的 Android 应用程序,是否有必要在安装时启用基于网络(手机信号塔)的位置?
好吧,这有点晦涩难懂,这是我在 stackoverflow 上的第一个问题。我已经四处寻找这个问题的答案,但找不到任何关于这个非常具体的问题的信息。这里是:
我创建了一个非常简单的应用程序,它将作为服务在后台运行,每隔一段时间它就会添加纬度和纬度。 SQLite 数据库表的经度条目。它使用课程位置信息(不检查它是否可用)。
我已经在我的设备上安装了该应用程序(来自 apk),并且从未遇到过问题。然而,我将它安装在我母亲的机器人上,每次运行它时总是出现“意外退出”错误。意识到她可能没有启用基于手机信号塔的位置,并且我的应用程序在设计时没有考虑到最佳实践(已检查),我很快在她的设备设置中启用了该选项并重新运行该应用程序。我仍然强制退出..所以我重新启动..重新运行..没有骰子。
然后,出于一种奇怪的预感,我决定再次安装该应用程序,但这次课程位置在安装时启用。令我惊讶的是,此后该应用程序运行完美。
所以..我还没有证实这些“理论”中的任何一个,但认为 stackoverflow 的伟大社区将是我对一些想法的最佳选择:
不知何故,在安装时我的应用程序具有课程网络很重要 启用..虽然,这似乎是一个明显的错误,而不是 可能(因为否则很多应用程序都会遇到这个问题) 除非以某种方式从市场安装并从 apk 安装 会产生不同的结果。
不知怎的,我的应用程序,用不好的做法编写,损坏了一些东西 它的安装位置并在重新安装时被擦除...
如果有人可以通过分享他们对这两个想法的一些了解(或者可能指出可以解释这种行为的完全不同的想法)来阐明这一点,那就太棒了。
OK, this is a little obscure, and my first question on stackoverflow.. I have searched around for an answer to this, but couldn't find anything about this very specific issue. Here goes:
I have created a very simple app which will run as a service in the background, every once in a while it will add latitude & longitude entries to an sqlite database table. It uses course location information (without checking whether it is available).
I have installed the app (from an apk) on my device and never had issues with it. However, I installed it on my mother's droid and kept getting "unexpectedly quit" errors each time I ran it. Realizing that she may not have had cell-tower based location enabled and that my app was not designed with best practices in mind (to have checked for that), I quickly enabled that option in her device settings and re-ran the app. I still got a force quit..so I rebooted.. re-ran.. no dice.
Then, on a weird hunch, I decided to install the app again, but this time the course-location was enabled at install time. To my surprise, the app worked flawlessly after that.
So.. I've not confirmed any of these "theories" but thought the great community at stackoverflow would be my best bet for some ideas:
Somehow, it matters at install time that my app has course-network
enabled..although, that would seem to be a glaring bug and not
likely (because so many apps would have this problem otherwise)
unless somehow installing from market and installing from an apk
will yield different results.Somehow, my app, written with bad practices, corrupted something in
its installed location and was wiped upon reinstall...
If someone could shed light on this, by sharing some of what they know about these two ideas (or maybe point out an entirely different idea that would explain this behavior) that would be awesome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ACCESS_COARSE_LOCATION 是访问 Wi-Fi 辅助位置信息所必需的。 ACCESS_FINE_LOCATION 仅向您提供 GPS 位置数据。如果启用这两个权限,则可以在这两个来源之间切换。
ACCESS_COARSE_LOCATION is a must to be able to access to wi-fi aided location info. ACCESS_FINE_LOCATION only gives you GPS location data. If you enable both permissions, you can switch between these two sources.