use of com.here.android.positioning.helpers.RadioMapLoadHelper in project here-android-sdk-examples by heremaps.
the class BasicVenueActivity method startPositionUpdates.
/**
* Initialization of Position Updates
* Called after map initialization
*/
private void startPositionUpdates() {
Log.v(TAG, "Start of Positioning Updates");
mPositioningManager = PositioningManager.getInstance();
if (mPositioningManager == null) {
Log.w(TAG, "startPositionUpdates: PositioningManager is null");
return;
}
mHereLocation = LocationDataSourceHERE.getInstance(mPositioningStatusListener);
if (mHereLocation == null) {
Log.w(TAG, "startPositionUpdates: LocationDataSourceHERE is null");
finish();
return;
}
mHereLocation.setDiagnosticsListener(new DiagnosticsListener() {
@Override
public void onDiagnosticEvent(Event event) {
Log.v(TAG, "onDiagnosticEvent: %s", event.getDescription());
}
});
mPositioningManager.setDataSource(mHereLocation);
try {
mPositioningManager.addListener(new WeakReference<PositioningManager.OnPositionChangedListener>(mActivity));
if (mIndoorPositioning) {
mLocationMethod = PositioningManager.LocationMethod.GPS_NETWORK_INDOOR;
Log.v(TAG, "Location method set to GPS_NETWORK_INDOOR");
} else {
mLocationMethod = PositioningManager.LocationMethod.GPS_NETWORK;
Log.v(TAG, "Location method set to GPS_NETWORK");
}
if (!mPositioningManager.start(mLocationMethod)) {
Log.e(TAG, "startPositionUpdates: PositioningManager.start returned error");
}
} catch (Exception ex) {
Log.w(TAG, "startPositionUpdates: Could not register for location updates: %s", Log.getStackTraceString(ex));
}
try {
mRadioMapLoader = new RadioMapLoadHelper(LocationDataSourceHERE.getInstance().getRadioMapLoader(), new RadioMapLoadHelper.Listener() {
@Override
public void onError(@NonNull Venue venue, RadioMapLoader.Status status) {
// Radio map loading failed with status.
}
@Override
public void onProgress(@NonNull Venue venue, int progress) {
// Radio map loading progress.
}
@Override
public void onCompleted(@NonNull Venue venue, RadioMapLoader.Status status) {
Log.i(TAG, "Radio map for venue: " + venue.getId() + ", completed with status: " + status);
// Radio map loading completed with status.
}
});
mVenueService.addVenueLoadListener(mVenueLoadListener);
} catch (Exception ex) {
Log.e(TAG, "startPositionUpdates: setting up radio map loader failed", ex);
mRadioMapLoader = null;
}
}
Aggregations