How to geolocate an android device by using Network Location Provider

元气小坏坏 提交于 2019-12-10 11:35:17

问题


I am trying to develop an Android application that can be used to find location of a friend who has also installed the application. The application will find location not using GPS but through Android Network location provider.

The person who want to get the location of a friend will send a particular SMS to the friend, the friend phone will then process the SMS in background, find the location using network location provider and reply the requester with a SMS containing the location.

So, I need help regarding (1): how to find location using Network Location Provider, and (2): how to implement the service that can read the incoming message in background and activate the application to do some job. Answers to any of the above two queries is highly appreciated. Thanks.


回答1:


Reto Meier has put out a lot of good information regarding the right way to do location. A good starting point is here: http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html

For the SMS piece, you are going to need to setup a BroadcastReceiver. Here is an example to get you started: http://androidsourcecode.blogspot.com/2010/10/receiving-sms-using-broadcastreceiver.html



来源:https://stackoverflow.com/questions/7191898/how-to-geolocate-an-android-device-by-using-network-location-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!