08-31-2009 10:25 AM
Hi guys.
I am having an issue when trying to get a cell network (MS-Based) location to work on my BlackBerry Bold 9000.
Both Assisted and Standalone GPS are working (outside ofcourse), but I am trying to find a way how to get positioning inside the building.
Here is what I am setting for criteria:
Criteria criteria = new Criteria(); criteria.setHorizontalAccuracy(Criteria.NO_REQUIRE
MENT); criteria.setVerticalAccuracy(Criteria.NO_REQUIREME NT); criteria.setCostAllowed(true); criteria.setPreferredPowerConsumption(Criteria.POW ER_USAGE_LOW); LocationProvider.getInstance(criteria); //<-- Returns null on real device
When I am running on a real device it always gives me null, when I am doing the same on simulator, then it works:
What I am doing wrong ? I really need to find a way to make it work indoors.
Thanks for any input.
Solved! Go to Solution.
08-31-2009 11:52 AM
I don't see where this is supported on the Bold - likely it depends on your network.
See the attached:
08-31-2009 02:37 PM - edited 08-31-2009 05:07 PM
Hey Dominator,
I'm going to be real straightforward with you, and try to save you ALOT of time.
Basically, cell-tower positioning does not work out of the box on the Blackberry platform (except in a few rare device/carrier setups). So, you can basically throw away the code you have above. If you are in need of indoor location detection, you will need access to a celltowerId database. These databases contain the tower information (cellId,mnc,mcc,lac) and its approximate position (lat/lng coordinates). This will give your application a rough estimate (within a mile or so) of the device's current location.
There are open source and professional databases available. Here is one open source database that works on GSM networks (of course, it does not have 100% coverage of all towers yet). The biggest downfall is it does not support CDMA networks (Sprint/Verizon).
You will find that most people on this board are not very helpful when it comes to cellTower positioning information, so you will need to research, research, research.
Best of Luck
09-01-2009 08:06 AM
Thank you for your response.
I had my doubdt's about this, just wanted to make sure.Thanks for the link I will check it.
01-02-2010 07:47 AM - edited 01-02-2010 08:38 AM
hi,
im in switzerland, and im pretty sure that my provider (orange) supports assisted / cell location positioning, purely because when i start up google maps, it tells me my position within say 2000 meters. even if im inside. only when i can see the sky, do i get a position within say 10 meters.
but my j2me app which i have written ONLY works outside.
does anyone know if blackberry handsets only let you use pure GPS if you use j2me?
im wanting to publish my app for all java enabled midp2.0 / cldc1.1 phones, so i dont want to start using any special BB APIs.
how come googleMaps can give me a location if im inside, but a j2me locationProvider cannot?
cheers,
ant
01-02-2010 10:09 AM
Google Maps uses google's own tower position database.
01-02-2010 01:06 PM - edited 01-02-2010 01:09 PM
I dont quite understand. Do they get some kind of location from the LocationProvider class and then check with their database as to where you are?
Because when Im inside, I dont get ANY information from the LocationProvider class. It just times out continueously (or the listener receives no data).
Where would I get the cell data? In the extras within the Location?
Or does BB provide some different API which gives you this info?
Something else I noticed while I was out and about today was that if I start my app when im still inside and then go outside, I dont always get a location - often the app simply keeps timing out. If I restart my app, I get a location almost straight away. Is there something in the docs which says if you get a timeout, you should re-instantiate the LocationProvider?
Cheers,
Ant
01-02-2010 01:36 PM
Google does not rely on LocationProvider - the have an alternate location method which retrieves the cell tower ID and hits their database of known cell tower locations. They *will* use LocationProvider once there is a more accurate location available.
When using autonomous GPS, you need a clear line-of-site to 3 satellites to get a fix. Generally, this fails if you are indoors.
There is a "status change" event when you go into or out of coverage using the LocationProvider. This requires that you reset the provider.
08-26-2010 06:21 AM - edited 08-26-2010 06:24 AM
pls hep me i got the exception when i run in my emulator
myLocationProvider=null
exception====java.lang.NullPointerException
and
i ran on 8520 device for testing its shows nothing
after that i had done a debug on device ==== it shows the same error in console pls help me
myLocationProvider=null
exception====java.lang.NullPointerException
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.location.*;
public class GPSMain extends MIDlet
{
private Display display;
Mycanvas canvas;
public GPSMain()
{
display = Display.getDisplay(this);
canvas = new Mycanvas();
}
public void startApp()
{
display.setCurrent(canvas);
}
public void pauseApp(){}
public void destroyApp(boolean a){}
}
class Mycanvas extends Canvas implements CommandListener
{
Alert positionAlert;
public Mycanvas()
{
try
{
Criteria myCriteria = new Criteria();
LocationProvider myProvider = LocationProvider.getInstance(myCriteria);
System.out.println("myLocationProvider="+myProvide
Location myLoc = myProvider.getLocation(60);
double lat = myLoc.getQualifiedCoordinates().getLatitude();
double lng = myLoc.getQualifiedCoordinates().getLatitude();
positionAlert = new Alert("Location Error");
positionAlert.setString("lat="+lat+" lng="+lng);
positionAlert.setTimeout(Alert.FOREVER);
}
catch(Exception e)
{
System.out.println("exception===="+e);
positionAlert = new Alert("Location Error");
positionAlert.setString(""+e);
positionAlert.setTimeout(Alert.FOREVER);
}
}
public void paint(Graphics g)
{}
public void commandAction(Command command, Displayable displayable)
{}
}
08-27-2010 01:24 AM
Hello Everyone,
i solved the doudt from a guy whose name is Rishab as he post the link
You need to set gps location in simulator please follow steps as mentioned in following URL.
http://supportforums.blackberry.com/t5/Testing-and
BUT its really works on emulator 8820 JDE.It doesnt work on my 8520 DEVICE, i ran the program as debug on device & then i got the error in console as
myLocationProvider=null
exception====java.lang.NullPointerException
is there any settings required on my 8520 device to get the current location as i m using my airtel network provider (as in j2me device its gives the current location).pls provide me help...
thanks a lot...............................................