I am beginner at android. I have a question. I want to when I receive SMS then get my location(latitude and longitude). How can I do. if you have sample code, it will be more helpful.
Thanks for your help.
I am beginner at android. I have a question. I want to when I receive SMS then get my location(latitude and longitude). How can I do. if you have sample code, it will be more helpful.
Thanks for your help.
For getting latitude and longitude when you have recived an sms on device you will need these steps:
STEP 1: Register an
android.provider.Telephony.SMS_RECEIVED
BroadcastReceiver for receiving incoming sms notification:for this you can use following Tutorial :
http://androidsourcecode.blogspot.in/2010/10/receiving-sms-using-broadcastreceiver.html
STEP 2:
for retrieving location on sms received you will need to start an service (
IntentService
) in onReceive of SMS BroadcastReceiver as:For How We use IntentService you can see following tutorial:
http://mobile.tutsplus.com/tutorials/android/android-fundamentals-intentservice-basics/
For how we Use LocationManager from Service class you can follow these Post:
Starting LocationManager as Service Android
please refer this example. I hope it helps you.
In this example the current location will be display and touched location will also display with lat-lon.