Android Open Handset Developers Community

 
It is currently Tue Jan 06, 2009 2:35 am



All times are UTC


 Topics   Replies   Views   Last post 
No new posts Google Maps with My Location (My Location)

by barban on Mon Aug 25, 2008 9:55 am in Novel advanced mobile services & applications based on J2ME/J2SE

7

500

Mon Aug 25, 2008 9:55 am

barban




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Google Maps with My Location (My Location)
PostPosted: Sun Jan 27, 2008 11:48 am 
Offline

Joined: Thu Dec 27, 2007 6:09 pm
Posts: 49
At the end of 2007 Google launched a new beta version (2.0) of the well-known Google Maps for Mobile (GMM). This new version 2, called Google Maps with My Location (My Location), is able to get the location of phones. This goal is accomplished using GPS if available, if not, the app relies on infomation from the cells of mobile network. So in the latter case the My Location feature is able to take information broadcasted from mobile towers to approximate your current location on the map.
Installation is very easy. Just go to http://www.google.com/gmm in your phone to download the application.

According to Google: "the My Location feature is available for most web-enabled mobile phones, including Java, BlackBerry, Windows Mobile, and Nokia/Symbian devices."
This statement is very interesting because it means that in the case of Java phones it is possible to retrieve cellID and other informations in a reliable way... but it is really true :?: :?:

Can somebody post here their experience with this feature ? Can it really work ?



Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Sun Jan 27, 2008 12:39 pm 
Offline

Joined: Fri Dec 28, 2007 12:53 pm
Posts: 18
I think My Location feature can work only in more recent phone models :cry: .

You can check if the feature works in the GMM application itself by going to Help, About:
if you read “myl: N/A,” it means My Location is not working with your device since it is not able to report cells it is using.

In Sony Ericsson K750i My Location does not work. I read somewhere that in K800i it does.


Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Sun Jan 27, 2008 12:57 pm 
Offline

Joined: Thu Dec 27, 2007 2:12 pm
Posts: 29
Wow, it looks a very nice feature !
I was wondering if Google will provide API of My Location functionality for developers.
It would be great to build customized location-based applications :!: .


Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Sun Jan 27, 2008 1:15 pm 
Offline

Joined: Thu Dec 27, 2007 6:09 pm
Posts: 49
There is no public API available at the moment, but some nice guys made some investigations on how to achieve that using a simple HTTP request by reverse engineering the GMM applet.
I suggest to have a look at ***URLs are hidden from guests, please register and login to view the hyperlink*** where you can find updated information on this topic. At the moment, from this source the following C# script is available in order to convert cell info into lat/long values.
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
using System.Diagnostics;

/*
* Sample code to obtain geo codes from a cell info
* "GSM/UMTS" setting revealed by smuraro, thanks!
*/

namespace GMM {
    class Program {
        static byte[] PostData(int MCC, int MNC, int LAC, int CID, bool shortCID) {
            /* The shortCID parameter follows heuristic experiences:
             * Sometimes UMTS CIDs are build up from the original GSM CID (lower 4 hex digits)
             * and the RNC-ID left shifted into the upper 4 digits.
             */
            byte[] pd = new byte[] {
                0x00, 0x0e,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00,
                0x00, 0x00,
                0x00, 0x00,

                0x1b,
                0x00, 0x00, 0x00, 0x00, // Offset 0x11
                0x00, 0x00, 0x00, 0x00, // Offset 0x15
                0x00, 0x00, 0x00, 0x00, // Offset 0x19
                0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, // Offset 0x1f
                0x00, 0x00, 0x00, 0x00, // Offset 0x23
                0x00, 0x00, 0x00, 0x00, // Offset 0x27
                0x00, 0x00, 0x00, 0x00, // Offset 0x2b
                0xff, 0xff, 0xff, 0xff,
                0x00, 0x00, 0x00, 0x00
            };

            bool isUMTSCell = ((Int64)CID > 65535);

            if (isUMTSCell)
                Console.WriteLine("UMTS CID. {0}", shortCID ? "Using short CID to resolve." : "");
            else
                Console.WriteLine("GSM CID given.");

            if (shortCID)
                CID &= 0xFFFF;      /* Attempt to resolve the cell using the GSM CID part */

            if ((Int64)CID > 65536) /* GSM: 4 hex digits, UTMS: 6 hex digits */
                pd[0x1c] = 5;
            else
                pd[0x1c] = 3;

            pd[0x11] = (byte)((MNC >> 24) & 0xFF);
            pd[0x12] = (byte)((MNC >> 16) & 0xFF);
            pd[0x13] = (byte)((MNC >> 8) & 0xFF);
            pd[0x14] = (byte)((MNC >> 0) & 0xFF);

            pd[0x15] = (byte)((MCC >> 24) & 0xFF);
            pd[0x16] = (byte)((MCC >> 16) & 0xFF);
            pd[0x17] = (byte)((MCC >> 8) & 0xFF);
            pd[0x18] = (byte)((MCC >> 0) & 0xFF);

            pd[0x27] = (byte)((MNC >> 24) & 0xFF);
            pd[0x28] = (byte)((MNC >> 16) & 0xFF);
            pd[0x29] = (byte)((MNC >> 8) & 0xFF);
            pd[0x2a] = (byte)((MNC >> 0) & 0xFF);

            pd[0x2b] = (byte)((MCC >> 24) & 0xFF);
            pd[0x2c] = (byte)((MCC >> 16) & 0xFF);
            pd[0x2d] = (byte)((MCC >> 8) & 0xFF);
            pd[0x2e] = (byte)((MCC >> 0) & 0xFF);

            pd[0x1f] = (byte)((CID >> 24) & 0xFF);
            pd[0x20] = (byte)((CID >> 16) & 0xFF);
            pd[0x21] = (byte)((CID >> 8) & 0xFF);
            pd[0x22] = (byte)((CID >> 0) & 0xFF);

            pd[0x23] = (byte)((LAC >> 24) & 0xFF);
            pd[0x24] = (byte)((LAC >> 16) & 0xFF);
            pd[0x25] = (byte)((LAC >> 8) & 0xFF);
            pd[0x26] = (byte)((LAC >> 0) & 0xFF);

            return pd;
        }

        static void Main(string[] args) {

            if (args.Length < 4) {
                Console.WriteLine("Usage: gmm MCC MNC LAC CID [\"shortcid\"]");
                return;
            }
            string shortCID = "";   /* Default, no change at all */
            if (args.Length == 5)   
                 shortCID = args[4].ToLower();

            try {
                String url = "http://www.google.com/glm/mmap";
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(new Uri(url));
                req.Method = "POST";
               
                int MCC = Convert.ToInt32(args[0]);
                int MNC = Convert.ToInt32(args[1]);
                int LAC = Convert.ToInt32(args[2]);
                int CID = Convert.ToInt32(args[3]);
                byte[] pd = PostData(MCC, MNC, LAC, CID, shortCID == "shortcid");

                req.ContentLength = pd.Length;
                req.ContentType = "application/binary";
                Stream outputStream = req.GetRequestStream();
                outputStream.Write(pd, 0, pd.Length);
                outputStream.Close();

                HttpWebResponse res = (HttpWebResponse)req.GetResponse();
                byte[] ps = new byte[res.ContentLength];
                int totalBytesRead = 0;
                while (totalBytesRead < ps.Length) {
                    totalBytesRead += res.GetResponseStream().Read(ps, totalBytesRead, ps.Length - totalBytesRead);
                }

                if (res.StatusCode == HttpStatusCode.OK) {
                    short opcode1 = (short)(ps[0] << 8 | ps[1]);
                    byte opcode2 = ps[2];
                    System.Diagnostics.Debug.Assert(opcode1 == 0x0e);
                    System.Diagnostics.Debug.Assert(opcode2 == 0x1b);
                    int ret_code = (int)((ps[3] << 24) | (ps[4] << 16) | (ps[5] << 8) | (ps[6]));
                       
                    if (ret_code == 0) {
                        double lat = ((double)((ps[7] << 24) | (ps[8] << 16) | (ps[9] << 8) | (ps[10]))) / 1000000;
                        double lon = ((double)((ps[11] << 24) | (ps[12] << 16) | (ps[13] << 8) | (ps[14]))) / 1000000;
                        Console.WriteLine("Latitude: {0}, Longitude: {1}", lat, lon);
                     
                        Process p = new Process();
                        p.StartInfo.FileName = "iexplore";

                        Console.WriteLine("\nClose map window to exit\n");

                        p.StartInfo.Arguments = String.Format(
                            "http://maps.google.de/maps?f=q&hl=de&q={0},{1}&ie=UTF8&z=15",
                            lat.ToString().Replace(',','.'), lon.ToString().Replace(',','.'));
                        p.Start();
                        p.WaitForExit();
                    }
                    else
                        Console.WriteLine("Error {0}", ret_code);
                }
                else
                    Console.WriteLine("HTTP Status {0} {1}", res.StatusCode, res.StatusDescription);
            }
            catch (Exception) {
                throw;
            }
        }
    }
}

Zoltan wrote:
Wow, it looks a very nice feature !
I was wondering if Google will provide API of My Location functionality for developers.
It would be great to build customized location-based applications :!: .


Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Sun Jan 27, 2008 1:23 pm 
Offline

Joined: Thu Dec 27, 2007 2:51 pm
Posts: 18
Hey, by reading your posts a question come up:
how Google is aware of the location of every antenna of different mobile operators all over the world :?: :?: :?:


Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Sun Jan 27, 2008 1:28 pm 
Offline

Joined: Thu Dec 27, 2007 6:09 pm
Posts: 49
Verix wrote:
Hey, by reading your posts a question come up:
how Google is aware of the location of every antenna of different mobile operators all over the world :?: :?: :?:


About this point, I suspect that Google's' database is very poor now, but it will be populated with fresh data thanks to the users having a GPS capable mobile device which are using GMM all over the world...

barban


Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Sat Aug 23, 2008 12:59 pm 
Offline

Joined: Sat Aug 23, 2008 12:40 pm
Posts: 1
I have been studding on LBS for quite some while now. What i understood from Google is that they are getting Location Information thru GPRS, J2ME application is used to display Maps and other information from Google Server.

Now the thing is how can we retrieve Location information thru GPRS. GRPS Application Layer has a protocol called GTP (GPRS Tunneling Protocol). This protocol is used to communicate or send SM between SGSN and GGSN.
In GTP we receive IMSI Number (MCC, MNC and MSIN) and also there is a field called Location Information. I have been researching on this, but nothing much i have received.

Can anyone pls let me know on how to retrieve GTP header?
please mail be at (rishi.dawar AT gmail DOT COM)


Regards
Rishi


Top
 Profile  
 
 Post subject: Re: Google Maps with My Location (My Location)
PostPosted: Mon Aug 25, 2008 9:55 am 
Offline

Joined: Thu Dec 27, 2007 6:09 pm
Posts: 49
rishidawar wrote:
ICan anyone pls let me know on how to retrieve GTP header?


Hi Rishi,
you are right, in the GTP protocol there is the Location Information field: it was originally specified to be able to track a user in case of an emergergency call.

For more in depth information, you can find the most appropriate 3GPP techical specifications of the UMTS system (all the 3GPP documents are public and can be found at ***URLs are hidden from guests, please register and login to view the hyperlink***), i.e. the TS 29.060.

Of course, the Location Information field could be also used by the network operator to offer location based services (provided that a specific solution to valorize this filed is implemented within the network) but the key point here is that this information is kept inside the mobile network: as you mentioned, the GTP protocol is an IP tunnel between network equipments. So in my view there is no possibility to retrieve the GTP header, if your code is located in the mobile phone.

Regards,
barban


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

Topic Tags

3GPP, LBS, UMTS


All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
phpBB SEO

This site is not affiliated with nor endorsed by the Open Handset Alliance.
All trademarks and logos used in this site are of properties of their respective owners.