Enable Latitude on Android

With the Android 1.1 and Android 1.5 images for the Android Dev Phone 1 (ADP1), Google Latitude is not available by default. It is possible to enable Latitude inside the Google Maps application by adding one record to a settings database.

At http://forum.xda-developers.com/showthread.php?p=3438480#post3438480 there are several steps described to enable Latitude. Adding a record to a settings database and updating a XML file (MapsActivity.xml) are needed to make Latitude available as menu item inside the Google Maps application.

Updating the MapsActivity.xml file is not that easy. The adb shell does not support a copy command and there is also no editor available inside the shell. With the use of cat it is possible to make a copy of the MapsActivity.xml to the sdcard of your Android device:

cat /data/data/com.google.android.apps.maps/shared_prefs/com.google.android.maps.MapsActivity.xml > /sdcard/MapsActivity.xml

Next you should mount the sdcard, edit the file on your desktop pc, unmount the sdcard and replace the MapsActivity.xml with the one which you changed on your sdcard:

cat /sdcard/MapsActivity.xml > /data/data/com.google.android.apps.maps/shared_prefs/com.google.android.maps.MapsActivity.xml

Because editing needs a lot of actions, I found a different way of enabling Latitude by only adding the record to the database. I performed the following steps on a device running Android 1.5, but I think it will also work on the Android 1.1 version.

  1. On your ADP1, choose Menu -> Settings -> Applications -> Manage applications -> Maps
  2. Push the Clear data button.This will remove the /data/data/com.google.android.apps.maps/shared_prefs/ folder which contains the MapsActivity.xml file.
    Don’t worry, the different xml files in this folder will be auto generated again with Latitude (Friend Finder) enabled.
  3. Clear Data of Maps Application

  4. Connect your ADP1 to your PC (with the use of the USB cable) and execute adb shell inside a Windows shell or Linux terminal
  5. Execute su inside the adb shell to give you more rights
  6. Change the current directory: cd /data/data/com.android.providers.settings/databases
  7. Run the sqlite3 application on the settings database: sqlite3 settings.db
  8. To see if the setting maps_enable_friend_finder is not already inside the settings database, make a dump of all the records inside the gservices table on the screen and look if the record already exists: .dump gservices
  9. Insert a new record: INSERT INTO “gservices” (name,value) VALUES(‘maps_enable_friend_finder’,’1′);. This record will hold the flag to enable Latitude
  10. Exit the sqlite3 application: .quit
  11. Exit the su mode: exit
  12. Exit the adb shell: exit
  13. On your Android device, run the Maps application. A popup will be shown that Latitude is available. Pressing Menu will show you the Join Latitude option.
  14. Latitude PopupJoin Latitude

By clearing the data of the Maps application (with the Clear data option) the /data/data/com.google.android.apps.maps/shared_prefs/ is removed containing settings for the map application. By adding the record to the database and starting the Maps application again, the /data/data/com.google.android.apps.maps/shared_prefs/ is generated again. Because of the maps_enable_friend_finder flag set to true (1) the MapsActivity.xml is also generated which enables Latitude.

2 Comments

  1. John N says:

    Two things. First on my rooted G1 I can avoid ADB by using the Terminal Program on the G1 with its keyboard.
    Second I already had a record maps_enable_friend_finder with value 0.

    I presume the command
    UPDATE "gservices" SET value = '1'
    WHERE name = 'maps_enable_friend_finder' ;

    will turn on Latitude. As my cupcake hasn't yet come, I will wait for that update first.

  2. Hang Zhang says:

    I'm using Android 1.6 on ADP1. Google map version is "3.1.2(#3189) gmm-google".

    John's way works. Thanks to you all.

    BUT the latitude function may be disabled again for some reasons I still dunno yet.

    And.. since 1.6, the xmls under shared_prefs have been changed. I suppose this blog need an update now ^_^

1 Trackbacks

  1. Anonymous

    [...] Johan de Koning >> Enable Latitude on Android [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>