Poor mans GPS - Cell(Tower)ID / Location Area Code -Lookup

Tutorials that use the MapActivity. Many using GPS functionality.

Postby phannguyen » Fri Aug 01, 2008 7:51 am

thanks brijeshthakur for reply me,
I have opened logcat and run it with my app.
I got a error message from logcat like below picture.
so how can i solve this problem?are u over this problem?

thanks for help!
Attachments
logcaterror.JPG
logcaterror.JPG (129.21 KiB) Viewed 9741 times
PhanNguyen
phannguyen
Experienced Developer
Experienced Developer
 
Posts: 56
Joined: Thu Jul 17, 2008 7:37 am

Top

Postby brijeshthakur » Fri Aug 01, 2008 1:30 pm

Hi phannguyen,

I am also getting the same error. actually the problem i guess is because of this app uses hidden api. so luck by chance it will run in US locations. but for others i m not sure.


so wait for the reply from plusminus.

till then..... :shock:

Regards,
Brijesh
brijeshthakur
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Jul 23, 2008 12:36 pm
Location: Banglore,India

Postby phannguyen » Mon Aug 04, 2008 4:41 am

it's really disappoint.i cant run any app related to map. :cry: :cry:
please help us,plusminus!
PhanNguyen
phannguyen
Experienced Developer
Experienced Developer
 
Posts: 56
Joined: Thu Jul 17, 2008 7:37 am

Need help to use ggogle secret api

Postby paslatek » Fri Feb 13, 2009 9:27 am

Hi

Could you provide a view of the tcp packet sent to google api to retrieve the datas.
I'm trying to use this api with a .Net call, so I need to compare the packet you send and mine, because I got a 501 error code :(

I just need the hexadecimal packet of the request content.

Thks.
paslatek
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Feb 13, 2009 9:22 am

Postby Sar » Thu Apr 02, 2009 2:31 am

ok i get a bunch of unresolved errors =/

basically for my api, everything under apache.commons is unresolved. seems i only have apache.common.logging;


additionally i dont have android.telephony.PhoneStateIntentReceiver. so i used PhoneStateListener instead. hope that suffices.

i changed import android.net.ContentURI to net.uri seeing page 2's advice. so thats that. but the http's got me reeling.

urmmm haha why is it missing? what pre-requisites do i require to use these codes?
Sar
Freshman
Freshman
 
Posts: 2
Joined: Tue Mar 17, 2009 2:43 am

knowing wether there is a good reception

Postby PI9 » Mon May 25, 2009 2:10 pm

Hello everyone,
I'd like to make an app which draws a picture when there is a normal/good reception and another picture when there is no reception.
I'im trying wih ServiceState but there is a problem and my app "stops unexpectely"...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private ImageView reception;
  2.  
  3. ServiceState mservicestate = new ServiceState();
  4.  
  5.                 int state = mservicestate.getState();
  6.  
  7.                 if(state == android.telephony.ServiceState.STATE_OUT_OF_SERVICE)
  8.  
  9.                         reception.setImageResource(R.drawable.reseau);
  10.  
  11.                 else
  12.  
  13.                         reception.setImageResource(R.drawable.pas_reseau);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Can you please hep me understand what's wrong in my program ?
Thanks in advance
PI9
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Apr 06, 2009 8:40 am

Top

Good Tutorial

Postby AniAnish » Mon Jun 08, 2009 1:03 pm

Good Tutorial :D Thank you PlusMinus
AniAnish
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Jun 08, 2009 12:59 pm

Postby jlamance » Tue Jul 14, 2009 2:08 pm

plusminus wrote:
quauhtlimtz wrote:It is not clear for me why use this way to locate people if you have the GPS option that is even more accurate. What are the advantages about using this way to locate people???


Hello quauhtlimtz,

there is exactly NO advantage, except the fact that perhaps not all phones come with a GPS-chip ;).

Regards,
olusminus


Great example! I'll take exception to using GPS all the time though.

There are a few advantages to having something other than (or in addition to) GPS to provide location. First GPS doesn't work everywhere. Suburban residential is about as harsh an environment as GPS can really work in, even with new high sensitivity receivers. Second, the GPS takes a fair amount of battery life (which is why you can turn it off). So if you're running an application that only needs rough location (1-5 km, for example), then the cell location may be the preferred method. An example would be trying to recover local weather where the additional accuracy of the GPS (if available) does not add to the app.
jlamance
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jul 14, 2009 2:00 pm

Postby lavans4u » Wed Jul 15, 2009 5:10 pm

hi pluas minus and aother friends

i want that software for a try.....am not able to caode and compile it because am a beginner in it...
so anybody please upload that software for me.....

http://people.apache.org/~dims/android/LocateMe-3.0.zip

i tried this link....but i can download it.....

please help me.....please
lavans4u
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Jul 01, 2009 6:46 pm

Postby Hetal_Vora » Mon Aug 10, 2009 9:39 am

Hi plusminus,

Good tutorial as always :) . I had a question...
Is it possible to implement network triangulation to locate the device position in Android. Your tutorial uses only a single cell tower to pin-point the location of the device. Is it possible to contact other cell towers (since a device would be communicating to more than 1 tower at any time), retrieve their position, plot their circle of coverage and get the device position as the intersection point.

I am unable to locate any API methods which would give me information of all the cell towers the device communicates with.
Hetal_Vora
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 07, 2009 11:20 am

problem with org.apache.commons.httpclient

Postby Ripityom » Wed Oct 07, 2009 2:13 pm

Hi plusminus!

I've got a problem while doing the tutorial.
Eclipse says that org.apache.commons.httpclient cannot be resolved.
I'm pretty new to android, I use 1.5 SDK and 1.5 firmware on the dev phone (well there's not mutch to do with it, i guess).

Any idea?

Thanx
Ripityom
Ripityom
Freshman
Freshman
 
Posts: 5
Joined: Wed Oct 07, 2009 2:06 pm

Re: problem with org.apache.commons.httpclient

Postby delta_foxtrot » Sun Nov 01, 2009 8:52 am

Ripityom wrote:Any idea?


The SDK has changed substantially:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.     private void getGoogleCellID(int lac, int cid)
  2.     {
  3.         int shortcid = cid & 0xffff;
  4.  
  5.         try
  6.         {
  7.             String surl = "http://www.google.com/glm/mmap";
  8.            
  9.             HttpClient httpclient = new DefaultHttpClient();
  10.             HttpPost httppost = new HttpPost(surl);
  11.             httppost.setEntity(new MyCellIDRequestEntity(shortcid, lac));
  12.             HttpResponse response = httpclient.execute(httppost);
  13.             HttpEntity entity = response.getEntity();
  14.             DataInputStream dis = new DataInputStream(entity.getContent());
  15.              
  16.              // Read some prior data
  17.              dis.readShort();
  18.              dis.readByte();
  19.              // Read the error-code
  20.              int errorCode = dis.readInt();
  21.              if (errorCode == 0)
  22.              {
  23.                   double lat = (double) dis.readInt() / 1000000D;
  24.                   double lng = (double) dis.readInt() / 1000000D;
  25.                   int range = dis.readInt(); // in metres
  26.                  
  27.                   System.out.println("From google with love: lat="+lat+", lon="+lng+", range="+range);
  28.              }
  29.         } catch (Exception e) {}
  30.     }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. class MyCellIDRequestEntity implements HttpEntity
  2. {
  3.      protected int myCellID;
  4.      protected int myLAC;
  5.  
  6.      public MyCellIDRequestEntity(int aCellID, int aLAC)
  7.      {
  8.           this.myCellID = aCellID;
  9.           this.myLAC = aLAC;
  10.      }
  11.  
  12.      public Header getContentType()
  13.      {
  14.          return new BasicHeader("Content-Type", "application/binary");
  15.      }
  16.  
  17.         @Override
  18.         public void consumeContent() throws IOException
  19.         {
  20.         }
  21.  
  22.         @Override
  23.         public InputStream getContent() throws IOException, IllegalStateException
  24.         {
  25.                 return null;
  26.         }
  27.  
  28.         @Override
  29.         public Header getContentEncoding()
  30.         {
  31.                 return null;
  32.         }
  33.  
  34.         @Override
  35.         public boolean isChunked()
  36.         {
  37.                 return false;
  38.         }
  39.  
  40.         @Override
  41.         public boolean isStreaming()
  42.         {
  43.                 return false;
  44.         }
  45.  
  46.     /** Pretend to be a French Sony_Ericsson-K750 that
  47.      * wants to receive its lat/long-values =)
  48.      * The data written is highly proprietary !!! */
  49.         @Override
  50.         public void writeTo(OutputStream outputStream) throws IOException
  51.         {
  52.         DataOutputStream os = new DataOutputStream(outputStream);
  53.         os.writeShort(21);
  54.         os.writeLong(0);
  55.         os.writeUTF("fr");
  56.         os.writeUTF("Sony_Ericsson-K750");
  57.         os.writeUTF("1.3.1");
  58.         os.writeUTF("Web");
  59.         os.writeByte(27);
  60.  
  61.         os.writeInt(0); os.writeInt(0); os.writeInt(3);
  62.         os.writeUTF("");
  63.         os.writeInt(myCellID); // CELL-ID
  64.         os.writeInt(myLAC); // LAC
  65.         os.writeInt(0); os.writeInt(0);
  66.         os.writeInt(0); os.writeInt(0);
  67.         os.flush();
  68.         }
  69.  
  70.         @Override
  71.         public long getContentLength()
  72.         {
  73.                 return -1;
  74.         }
  75.  
  76.         @Override
  77.         public boolean isRepeatable()
  78.         {
  79.                 return true;
  80.         }
  81. }
Parsed in 0.041 seconds, using GeSHi 1.0.8.4
delta_foxtrot
Freshman
Freshman
 
Posts: 2
Joined: Sun Nov 01, 2009 8:49 am

Postby estebanuri » Fri Nov 20, 2009 8:46 am

Does anyone know how to get ALL IDs Cell Tower in range of the device?

If we could have all the Cell Ids, we could calculate the position much more accurately, for example if we had several antennas we could average their latitudes and longitudes. The problem is that at a time we can get a single antenna.

Will there be any way to get them all?
estebanuri
Freshman
Freshman
 
Posts: 2
Joined: Fri Nov 20, 2009 8:35 am

Postby delta_foxtrot » Fri Nov 20, 2009 5:09 pm

estebanuri wrote:Does anyone know how to get ALL IDs Cell Tower in range of the device?

If we could have all the Cell Ids, we could calculate the position much more accurately, for example if we had several antennas we could average their latitudes and longitudes. The problem is that at a time we can get a single antenna.

Will there be any way to get them all?


Yes you can get the neighbouring Cell IDs, and even the signal strength.
delta_foxtrot
Freshman
Freshman
 
Posts: 2
Joined: Sun Nov 01, 2009 8:49 am

Postby estebanuri » Fri Nov 20, 2009 5:42 pm

That's right, I didn't see the right class API.

http://developer.android.com/reference/android/telephony/TelephonyManager.html

public List<NeighboringCellInfo> getNeighboringCellInfo ()

Since: API Level 3
Returns the neighboring cell information of the device.
Returns
List of NeighboringCellInfo or null if info unavailable.
Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}

Thank you delta_foxtrot!

PS: It is remarkable that implements it, other platforms such as Blackberry does not include it in their API.
estebanuri
Freshman
Freshman
 
Posts: 2
Joined: Fri Nov 20, 2009 8:35 am

Top
PreviousNext

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests