问题
Details of my phone:
Model:Blackberry Curve 8520
Version :5.0.0.1036
data services :on
When I am installing google maps I am able to see the location ,so there is a chance of obtaining the current location using this phone.
I am trying to develop an application which will show the current location of the phone,by using the cell site locations because this phone model does not have an in-built GPS device.
I am using the following code:
BlackBerryCriteria bc=new BlackBerryCriteria(GPSInfo. GPS_MODE_CELLSITE );
try {
LocationProvider lp=LocationProvider.getInstance(bc);
if(lp !=null)
{
Location loc=lp.getLocation(-1);
add (new EditField(loc.getQualifiedCoordinates().getLatitude()+"\n"+loc.getQualifiedCoordinates().getLongitude(),""));
}
else
{
add(new EditField("unable to find the location provider", ""));
}
} catch (LocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}}
I am installing the alx file on the bb phone using desktop manager.
On starting the application it is giving me an Uncaught exception:
NET.RIM.DEVICE.API.SYSTEM.UNSupportedOperationException.
回答1:
The device might currently not support GPS_MODE_CELLSITE. Check using
GPSInfo.isGPSModeAvailable(GPS_MODE_CELLSITE)
and use another mode if neccessary.
It might not support GPS_MODE_CELLSITE because:
- There is no valid SIM card in your phone (ok, i assume you have one :)
- Check if your device and carrier have available GPS mode you are using (here)
- If your carrier is Verizone, check for Verizon GPSSettings signing requirement
- Your APN settings are not correct (Options > Device > Advanced Settings > TCP IP)
- You don't have a BlackBerry Service Plan (not too sure about that one)
来源:https://stackoverflow.com/questions/7816724/obtaining-cellsite-gps-location-on-blackberry-curve-8520