Blackberry GPS and BlackBerry Maps Podręcznik - Strona 10
Przeglądaj online lub pobierz pdf Podręcznik dla Oprogramowanie Blackberry GPS and BlackBerry Maps. Blackberry GPS and BlackBerry Maps 35 stron. Version: 4.7.0
Development Guide
Get location information updates
You can associate only one LocationListener object with a particular provider for GPS location information. The
BlackBerry® device application typically listens for updates on a separate thread.
1.
Implement the LocationListener interface.
2.
To register your implementation, invoke LocationProvider.setLocationListener().
Change the criteria for obtaining location information
1.
Create a new Criteria object.
Criteria criteria2 = new Criteria();
2.
Invoke the setHorizontalAccuracy(), setVerticalAccuracy(), setCostAllowed(), and
setPreferredPowerConsumption() methods of the new Criteria object to specify the new criteria.
3.
Invoke LocationProvider.reset().
LocationProvider.reset();
4.
Specify the LocationListener to null.
provider.setLocationListener(null, -1, -1, -1);
5.
Invoke LocationProvider.getInstance() using the new Criteria object as a parameter to create a new
instance of a LocationProvider.
provider = LocationProvider.getInstance(criteria2);
6.
Specify the LocationListener.
provider.setLocationListener(LocationListener listener, int interval, int
timeout, int maxAge);
8
Getting GPS location information