You are here: home » blog » android-determinig-location-using-gsm-googles-geolocation-api

What's he up to?

Android: Determining location using GSM and Google’s Geolocation API

From Askar Bakirov. February 23, 2010, 2 Comments

As the Google API for Android doesn’t provide latitude and longitude for GSM, I made a simple class which performs the following actions:

This API also can provide street, post code, etc.
You can read more about the protocol here.

The problem is that locating by GSM is not very accurate and can change drastically if there are many cell towers around you.
This could be improved by passing signal strength, and information from several surrounding towers (for example, a sort of sliding window from the latest towers). Also, Google provides a unique token when you send the first request, so you can pass it along for better result.

public class MainActivity extends Activity implements GsmLocationListener {
...
		myGsmManager = new GsmLocationManager(
				(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE));
		myGsmManager.setMinimalUpdateInterval(30000L);
		myGsmManager.subscribe(this);
...
	@Override
	public void onLocationChanged(Location location) {
		myTextView.setText(String.format("latitude = %s\n" + "longitude = %s\n"
				+ "altitude = %s\n" + "accuracy = %s\n" + "provider = %s\n" + "Update at %s", location.getLatitude(), location
				.getLongitude(), location.getAltitude(), location.getAccuracy(),location.getProvider(), new Date(System.currentTimeMillis())));
	}
...

Here is the source code.

Please comment, if you know how to make the result more accurate.

2 Responses to “Android: Determining location using GSM and Google’s Geolocation API”

  1. MORRIS says:


    Pillspot.org. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. High quality pills. Buy pills online

    Buy:Viagra.Viagra Super Force.Soma.VPXL.Cialis Soft Tabs.Propecia.Super Active ED Pack.Viagra Super Active+.Zithromax.Cialis Professional.Viagra Soft Tabs.Viagra Professional.Cialis.Maxaman.Cialis Super Active+.Levitra.Tramadol….

  2. ALLAN says:


    MedicamentSpot.com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. No prescription drugs. Buy drugs online

    Buy:Nexium.Prevacid.100% Pure Okinawan Coral Calcium.Synthroid.Prednisolone.Mega Hoodia.Accutane.Lumigan.Valtrex.Arimidex.Human Growth Hormone.Retin-A.Petcam (Metacam) Oral Suspension.Actos.Zyban.Zovirax….

Leave a Reply


last modified on 2010-02-23 @ 15:10