Gemalto is now part of the Thales Group, find out more.

You are here

Thales IoT Developer Community

Cell ID based positioning demo

Showcase, February 25, 2016 - 9:40am, 6580 views

Hi All,

Recently, I've done some research on the  topic of "Cell ID based positioning / location".

Hope my experience can help others to evaluate / implement this technology.

All the material, including Power Point presentation, demo server and Java midlet is available here

I would like to share a few code snippets for some tricky parts in the midlet:

Sending Form data in HTTP POST Request:

connection = (HttpConnection)";" + connProfile);

//HTTP Request
connection.setRequestProperty("Content-Language", "en-US");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
String msg = "sender=name&message=text";
OutputStream out = connection.openOutputStream();
// HTTP Response
if (connection.getResponseCode() == HttpConnection.HTTP_OK)
{	System.out.println("Message Sent successfully");	}

Get GPS location from EHS8 modem:

WTK library AT commands listener exits right after it sees OK in response, which is OK for most AT commands. However when you enable GPS, first you'll get an OK and then NMEA messages with location info, that you will miss, since the listener has finished it's job.

Luckily we've got JSR 179 support in our Java Library, which makes life even easier:

try  {  provider = LocationProvider.getInstance(criteria); }
catch (LocationException e) { e.printStackTrace(); }
finally {
if(null != provider) {
try {
location = provider.getLocation(-1);
catch (Exception e) { } System.out.println("location=" + location); }

Capturing Cellular Network Scan Report:

Performing Network Scan takes 2-3 minutes, by that time AT command response listener can time out. Here is how to capture it all:

 private class NetworkScanReportListener implements ATCommandResponseListener {
  public void ATResponse(String Response) {
    NetworkScanReport += Response; 
	if ( utilities.indexOf(new StringBuffer(Response), "OK", 0) != -1) NetworkScanFinished = true;
private void NetworkScan()  throws IllegalStateException, IllegalArgumentException, ATCommandFailedException, InterruptedException {
  NetworkScanReport = "";
  NetworkScanFinished = false;
  System.out.print("Starting Network Scan");
  m_Cmd.send("AT^SNMON=\"INS\",2\r", new NetworkScanReportListener());
  System.out.println("Network Scan Finished");

STDOUT should look like this:

Starting Network Scan......................................................Network Scan Finished

Very good post! Thanks





Somewhere over the rainbow!!! Looking for the Oz Land!!!


I cannot open the to get the material.

Best Regards

Antero Markkula
Communication and Mechatronics

Enkom Active Oy –
Upseerinkatu 3 A, 02600 Espoo, Finland
Mobile: +358 400 411368
Office: +358 10 204 0000
Fax: +358 10 204 0010

Thank you for this! could you look at the link again, because I really would like to download the material.




ASHVARTS's picture