I use the follwoing code to get the Location data
Criteria csCriteria = new Criteria();
csCriteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
csCriteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
csCriteria.setCostAllowed(true);
开发者_JAVA技巧 csCriteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
LocationProvider provider = LocationProvider.getInstance(csCriteria);
Location location = provider.getLocation(-1);
the code works on BB 5.0 but now im testing it on BB 6.0 but it get LocationException with this msg Timed out while waiting for GPS Location (i use BB Torch on ATT , i have internet connection and GPS/Location is on) any idea why im getting this exception.
According to the Criteria documentation your specifications will result in Cellsite mode. I suspect ATT is not providing Cellsite support.
I figure out how to get the GPS without timeout error using this Criteria.
criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
criteria.setCostAllowed(true);
criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
For an example on how to get the GPS location for BlackBerry 6.0 click here.
精彩评论