here-android-sdk-examples
here-android-sdk-examples copied to clipboard
HERE SDK Orientation change too late
Hi all!
I am using HERE-Android-SDK to build a simple navigation solution with offline maps.
In order to automatically center and rotate the map (depending on location and orientation of the user) I am using the PositioningManager
class from the HERE-SDK. It seems that the orientation update is some seconds too late when an active navigation is running.
I am using the following code snippets to do so.
val positioningManager = PositioningManager.getInstance()
positioningManager.addListener(WeakReference(positionListener))
positioningManager.start(PositioningManager.LocationMethod.GPS)
var positionListener = object : PositioningManager.OnPositionChangedListener {
override fun onPositionFixChanged(
p0: PositioningManager.LocationMethod?,
p1: PositioningManager.LocationStatus?
) {
// do nothing here
}
override fun onPositionUpdated(
method: PositioningManager.LocationMethod?,
position: GeoPosition?,
isMapMatched: Boolean
) {
if (position == null) return
// update map center and orientation
}
}
override fun onPause() {
positioningManager.stop()
}
override fun onResume() {
positioningManager.start(PositioningManager.LocationMethod.GPS)
}
Is there anything I can do to avoid the too late orientation update? Thanks for all of your help in advance!
Hi @andreas-arkulpa
SDK also provides PositionListener
in guidance mode -
https://developers.here.com/documentation/android-premium/3.19/content/api_reference_java/com/here/android/mpa/guidance/NavigationManager.PositionListener.html
@NazarKacharaba Thanks for the hint! That means during guidance I should use PositionListener instead of PositioningManager?
Hello, I'm facing the same issue, reported to Here almost 3 years ago, no improvements ware made as I'm testing with current SDK (3.20.2.67). We sent video examples comparing Here Android Premium SDK (right) and Here WeGo (left) application from the Play Store on same device:
http://development.mobilisis.hr/download/20191007_121924.mp4
Position when in navigation mode always lags from real position on map, we tried using Here data source, custom data source, EnhancedMapMatcher and the problem is still there.
Unfortunately, this is true. However, a fix is delivered with HERE SDK (Navigate Edition) 4.15.6.0.