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 开发者_如何学Goher 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.
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.
精彩评论