Many Thanks to Nicholas and bloid for comments on my previous blog post. Here’s an update with some commentary
Step #1: Get the Cell-Id, LAC, MCC and MNC from the cell phone
Set up a PhoneIntentReceiver as shown below:
// Set up the handler for receiving events for service state etc. mPhoneStateReceiver = new PhoneStateIntentReceiver(this, new ServiceStateHandler()); mPhoneStateReceiver.notifyServiceState(MY_NOTIFICATION_ID); mPhoneStateReceiver.notifyPhoneCallState(MY_NOTIFICATION_ID); mPhoneStateReceiver.notifySignalStrength(MY_NOTIFICATION_ID); mPhoneStateReceiver.registerIntent();
And the handler snippet is below. Note that he MNC/MCC information is returned by the getOperatorNumeric method.
/**
* Notification Handler for Phone events
*/
private class ServiceStateHandler extends Handler {
private boolean updateOnce = false;
public void handleMessage(Message msg) {
Log.i("LocateMe", "In handleMessage : " + msg.what);
switch (msg.what) {
case MY_NOTIFICATION_ID:
ServiceState state = mPhoneStateReceiver.getServiceState();
notification_cid = state.getCid();
notification_lac = state.getLac();
notification_signal = mPhoneStateReceiver.getSignalStrength();
notifiction_operator_numeric = "" + state.getOperatorNumeric();
if (updateOnce == false) {
updateOnce = true;
updateTextFields();
}
break;
}
}
}
Here’s a screen shot with the default values that you get from the emulator:

Since the default information from emulator is unusable, let’s find something we can use say from this site -
“groovy mother…”
Here’s a screen shot:

Step #2: Convert the Cell information into an Address
Now the question is how do we get an address information from the cellid/lac/mnc/mcc. The GNUCITIZEN site has a nice tip on how to use the ZoneTag API from Yahoo. So we construct a nice URL with the information entered on screen.
http://zonetag.research.yahooapis.com/services/rest/V1/cellLookup.php?apptoken=ZoneTagDemoToken&cellid=20442&lac=6015&mnc=410&mcc=310
Just Click on the URL above to see the XML that it returns.
Step #3: Convert Address into a Lat/Long
Just use the Yahoo GeoCode API. We parse the XML from the previous step, extract the city, state, zip and construct a new URL.
http://local.yahooapis.com/MapsService/V1/geocode?appid=YahooDemo&city=Boston&state=Massachusetts&zip=02215
Again just Click on the URL above to see the XML that it returns.
Step #4: Launch the Maps
ContentURI uri = ContentURI.create("geo:" + myContentHandler2.getLatitude()
+ "," + myContentHandler2.getLongitude());
Intent intent = new Intent("android.intent.action.VIEW", uri);
startActivity(intent);

Piece of cake
[...] UPDATE: Nov 30, 12:37 EST – Version 2.0 is here [...]
Pingback by Android - Access Cell Phone details (Cell-Id, LAC, Signal Strength) « Show me the code! — November 30, 2007 @ 12:38 pm
Hi
I succeed to compile it but I did’t found how to run it…
I try to put it under Eclipse but import failed.
I am working under linux.
Any help welcome.
Your appli looks very nice and I would like to run it.
Thank’s
Comment by Andre — December 1, 2007 @ 11:33 am
When I run the app the just click on the “Locate Me!” button, I get an error message telling “Application error: com.google.android.maps An error has occured in process com.google.android.maps. Unable to start activity [.....]“. Any ideas ?
Comment by l3v1 — January 3, 2008 @ 5:04 am
[...] Then I build the XML SAX parsing part by referenced from Davanum Srinivas’ LocateMe at: http://davanum.wordpress.com/2007/11/30/android-poor-mans-my-location-show-current-cell-location/ [...]
Pingback by Mobile Application Code Shogun » Blog Archive » Android GoogleMaps Mini — March 7, 2008 @ 11:43 pm
you can send the locateme for my email?? your link is broken.
olucio@gmail.com
thanks!!
Comment by lucio flavio — October 30, 2009 @ 10:40 am