If you can do an HTTP Post to an arbitray website, you can use Google's geolocation api.
Simply POST data in the following JSON format to https://www.google.com/loc/json.
See the above link on how to add more information to your json from wifi etc. to greatly increase the accuracy of the result. And pay special attention to the mobile country code, getting it is not obvious.
{
"version": "1.1.0",
"cell_towers": [
{
"cell_id": "42",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code.": 410,
"age": 0,
"signal_strength": -60,
"timing_advance": 5555
},
{
"cell_id": "88",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code": 580,
"age": 0,
"signal_strength": -70,
"timing_advance": 7777
}
]
}
This will return you Google's estimate of the latitude/longitude on your location, along with accuracy and optionally a geocoded address. You can test it quickly e.g. with the Chrome extension called REST Console.
However, it seems that the Blackberry API only provides info on the currently connected cell, not other visible but unregistered cells. In this situation cannot do triangulation, as you (unsuprisingly) need three points to triangulate! However, a less accurate radial estimate of location is still possible.
You can still use the Google API for this, by providing only one tower, or you can use the Ericsson API if you choose. You might want to test with both and compare the accuracy. The Ericcson API is a similar JSON api to Google's, but only expects a single cell as input. A tutorial is available, but it boils down to a JSON request like this:
StringBuffer url = new StringBuffer();
url.append("http://cellid.labs.ericsson.net/json/lookup");
url.append("?cellid=").append(cell.getCellId());
url.append("&mnc=").append(cell.getMnc());
url.append("&mcc=").append(cell.getMcc());
url.append("&lac=").append(cell.getLac());
url.append("&key=").append(API_KEY);
try {
byte[] data = getHttp(url.toString());
if(data!=null) {
JSONObject o = new JSONObject(new String(data));
JSONObject pos = o.getJSONObject("position");
this.longitude = pos.getDouble("longitude");
this.latitude = pos.getDouble("latitude");
this.accuracy = pos.getDouble("accuracy");
this.cellName = pos.optString("name");
}
} catch (IOException e) {
e.printStackTrace();
}