views:

1867

answers:

7

Is there a way of programmatically determining a rough geographical position of a mobile phone using J2ME application, for example determining the current cell? This question especially applies to non-GPS enabled devices.

I am not looking for a set of geographical coordinates, but an ability for a user to define location specific software behaviours.

Solution for any hardware will be highly appreciated; however the more generic a solution is — the better. Many thanks!

A: 

I don't believe there is a general J2ME API for determining location.

I do know that BlackBerry has a specific API for retrieving not only the rough 'cell' location, but also a GPS API as well.

I'm afraid, at the moment, the GPS solutions are proprietary by manufacturer.

Ken Gentle
Thanks Ken, any links you could supply for BlackBerry?
Totophil
You may have to register as a BB developer (free) to view this document.There is also apparently a JSR for javax.microedition.location and BB has an implementation.[http://na.blackberry.com/eng/developers/javaappdev/advancedfeatures.jsp]
Ken Gentle
+6  A: 

If the device supports the JSR 179 location API, you can use this. Last time I looked into this hardly any devices supported it, but that was a few years back.

Dan Dyer
A: 
The question didn't specify to what accuracy. If the app just needs to know what particular city or zip code, then just knowing the strongest cell-tower is "good enough". In dense urban areas, just knowing the cell tower can be as accurate as a few city blocks.
James Schek
I know it didnt specify to what accuracy, I just thought I'd put it there. :)
+5  A: 

Hello, this is my first post one stackoverflow.

You can get the cellID (The id of the phone pole that the mobile is connected to) on a lot of phones thru System.getProperty(String arg) Here i have an example that tries a few keys to see if a cellID can be found. I have tested this on a lot of SonyEricsson mobiles and it works fine, as long as it isn't a Symbian mobile like P1 and so on. If you search the net you probably could find a lot more keys to find cellID:s for motorola, samsung and so on.

try{
  String[] cellIDTags = {"com.sonyericsson.net.cellid", "phone.cid", "Siemens.CID", "CellID"};
  for(int i = 0; i < cellIDTags.length; i++){
    cellID = System.getProperty(cellIDTags[i]);
    if(cellID != null && cellID != ""){
      location.setCellId(cellID);
      break;
    }
  }
}catch(Exception e){
  cellID = "";
}
A: 

Hi Dan, The code you have written to get cell_ID of base station. My question is if i will get the base station cell_id how i will be able to get the location of my cell.Location means some string name & not the longitude & latitude. If u have any solution pls. provide me.......

A: 

Hi dan, the code u have written is : try{ String[] cellIDTags = {"com.sonyericsson.net.cellid", "phone.cid", "Siemens.CID", "CellID"}; for(int i = 0; i < cellIDTags.length; i++){ cellID = System.getProperty(cellIDTags[i]); if(cellID != null && cellID != ""){ location.setCellId(cellID); break; } } }catch(Exception e){ cellID = ""; }

I am not able to understand the line: location.setCellId(cellID); What u want to achieve with this value. R u trying to set cellID for Location APIs or what? Please clarify it.....

A: 

I have browsed through many application download site , but didn't find any :: But i am sure some research on this could help you build your own application with J2ME API. As the code given by DAN gives the base station number. You can recognize the nearest station that the cell is able to correspond to . Actually a cell is able to capture at least 6 stations simultaneously , so as deamonkid explains multilateration can be used to approximate the position, provided you have a georeferenced map of your area or city. The application will calculate the distance and direction from the nearest tower and the map already has the coordinate of that base station . So you can calculate the spatial coordinate(estimated ) suresh. You may get the accuracy of 100 meters by this. This probably needs the signal strength measuring application which probably you may get to download. Now if you can generate code based on this please share. I am also into extensive research on this. Good luck suresh and all