HERE Android SDK NavigateManager simulate without Map is not giving maneuvers - android

I am using the HERE Android SDK embedded in a QT application, and am trying to do turn by turn directions simulated, but without a map display. There is no Map or MapFragment in my app, I'm using the MapEngine and NavigationManager directly. And I am initializing the map engine on the main UI thread, as that is recommended (not sure if that could be an issue here).
I am able to initialize the map engine, create the route and dump it successfully. However, when I use NavigationManager to simulate the route, I can see navigation movement (the coordinates in position updates progressing). However, I have ManeuverEventListeners and NewInstructionEventListeners, and they are never called.
And in my position listener, if I call getNextManeuverDistance() or getETA() I get error responses. All other functions had success, and the simulated navigation will complete eventually (at the expected time) but without ever delivering any instructions.
I have the same code working fine in a sample app, but running in the QT framework I'm never getting valid distances or maneuvers. In the API reference it says getNextManeuver() will return null (and get distance returns MAX_INT) if the next maneuver is not available yet. What can be causing this?
Is it valid to run this in an app without a Map nor a MapFragment? Any ideas why NavigateManager simulate would act this way?

Yes, I eventually figured out that the map data must be manually preloaded. Seems that calculating the route is not enough, and the data fetching is normally done by the map view, and the navigation manager is just waiting for the map data.
In my case, as soon as I have a calculated route I start the mMapDataPrefetcher.fetchMapData(route,radius), and then immediately start the mNavigationManager.simulate(route,speed). The navigation is a little wonky until the map data is loaded, but starts responding immediately after the map loading is complete. The loading can be slow in some of my testing, not sure why. But in frequent uses, the map data is often already present, so works better in that case.
I'm not sure what a good radius is; I tried 500m and the call failed; 2000m is working for me right now.
See the pages here:
https://developer.here.com/documentation/android-premium/topics/map-data.html
https://developer.here.com/documentation/android-premium/topics/maps-offline.html
These features are described as beta, so I'm not sure if there is any way to do this in a supported, production fashion.

Related

I/Counters: exceeded sample count in FrameTime log

I recently started to see this logs I/Counters: exceeded sample count in FrameTime multiple times in my app logcat, I understood it comes from Google Maps.
Any idea what it means? and how to get rid of it?
Try disabling a few layers of the widget (like say 'myLocation' layer enabled by using 'myLocationEnabled' parameter) and enable them back in the release build. Also make sure you are disposing your Google Maps Controller in the dispose method (if you are storing it somewhere after taking it from onMapCreated).
As far as I can figure out from the error and the API docs, GoogleMaps has multiple layers and each layer needs to be built in a given FrameTime. Since the added burden of multiple layers slow down the processing, it may exceed given FrameTime and trigger the error.
The reason may also include the fact that debug builds have no optimisations and that really affects the GoogleMaps package. I tried the same app with the constant barrage of 'I/Counters: exceeded sample count in FrameTime' errors in release build on a real device and the errors seem to not appear, implying these errors can simply be ignored.
While we wait for a fix you can set these to fold (in Android Studio) by going to File->Setting->Editor->General->Console and adding "exceeded sample count in FrameTime" to the list "Fold console lines that contain:"
I had the same issue since this morning, it was gone when after I:
stopped my emulator
wiped the data
cold booted it.
NOTE: this is with android
For Android emulators it's enough to wipe the data of the device and the FrameTime messages will go away.
EDIT: Sadly, this isn't a permanent solution as messages will start appearing after re-opning the emulator. I will be back with another update if I stumble upon a permanent fix.
I had a similar issue, for me I had setup a location listener:
location.onLocationChanged.listen(l) {
controller.animateCamera(...);
}
This appeared to be called even though the phone location had not changed, so I added a check to store the previous known location and in the listen, I compared the streamData with my location and only performed the update if there was a change.
Perhaps you can post your code to see if this could be the reason?
It's happening inside onLocationChanged method.
When I set isMyLocationEnabled to false at some extent it was removed but fully, now there were lesser log statement.
It happens when the map moves (or probably more specifically when it is redrawn). Both when animating, and also when manually sliding it around. My logcat is spammed full of Counters: exceeded sample count in FrameTime messages. This explains why you'll see less when not having my location enabled: The map doesn't move as much...
It's so annoying.
For flutter: I was using setState() method with a google map and there was also a locationListener(). So I removed the setState() and instead I did update my screen using provider. And the warnings were gone.

I want to track user's real world activity on android ,which method is better ,GPS or activityRecognition?

I want to track user's real world activity on android ,which method is better ,GPS or activityRecognition?
and one of the situation is when user suddenly running, i want to detect user's activity change immediately how can i do?
According to your basic requirements I'll suggest you to use ActivityRecogniserAPI, but ActivityRecogniserAPI doesn't give you the results immediately specially on the places where Location Services are not responding quickly.
But if you use GPS then you can speedup the process little bit, but you have to do a-lot or work to achieve this by running some process, doing calculations, handling events etc. It will be little bit fast as compared to ActivityRecogniserAPI but you will be having issue in this as well when Location Services are not responding quickly.
If the slow process works for you then I'll suggest you to use ActivityRecogniserAPI.

HERE Android SDK trial

I'm using HERE SDK trial and I want to ask that RealisticViewListener and LaneInformationListener works with trial license? Because I have registered listeners but I don't get any event.
navigationManager.addLaneInformationListener(new WeakReference<>(laneInformationListener));
navigationManager.setRealisticViewMode(NavigationManager.RealisticViewMode.DAY);
navigationManager.addRealisticViewAspectRatio(NavigationManager.AspectRatio.AR_4x3);
navigationManager.addRealisticViewListener(new WeakReference<NavigationManager.RealisticViewListener>(realisticViewListener));
Both features are available in the trial (as well as all other features). Your implementation looks correct, but it will be hard to determine where things go wrong without seeing more code.
Also, please be aware that in rare cases there is simply no lane- or signposts information available, e.g. the callback only occurs when the user has arrived at a point in the route where lane information is available such as before a highway exit.
I suggest to try out the SDK navigation example on GitHub and hook your listeners in from there to see how it works. You can also start navigation simulation (if you are unsure if your local area has enough data):
// if user wants to start simulation, submit calculated route
// and a simulation speed in meters per second
error = navigationManager.simulate(route, 60);

Rerouting in Skobbler Map

I am trying to resume navigation in the route that is cached but I could hardly find any method which could perform that feature in SKmaps. Therefore I am trying to customize the rerouting technique so that the user will be navigated to the same route.
Is there any way to perform custom rerouting in skobbler map?
This question is similar to the one posted in SKForum
What do you mean by "resume navigation in the cached" route? Are you referring to the saveRouteToCache and loadRouteFromCache APIs? (details here)
A rerouting call is triggered whenever the navigation engine detects that you are no longer following the route - i.e. you've been "matched" to a street/street segment that is not part of the original route. When recalculating the route, the same route settings used for the original route calculation are used (same end point, same routing profile, same via points) - the only difference being the start position (which is you current position).
In the scenario you have described on the forums you are calculating a route from a list of points and I'm assuming that you are starting to navigate on that particular route. Once you start moving I'm assuming that the navigation engine detects that you are not on the route (cannot really tell without looking at your input data) and triggers a rerouting call - at that time the routing engine attempts to create a route from your current position to the initial route and fails.
If you'd like to stop the rerouting logic, when you receive the call to onReRoutingStarted, call stopNavigation and trigger a route recalculation with your own routing engine.

SKNavigationListener issues with event handling

I am developing an Android application using skobbler/telenav SDK also known as SKMaps. I am currently implementing a simple gps navigation system using SKRouteManager and SKNavigation manager and the corresponding Listeners. So far I have been able to set the destination for my navigation by geocoding postcodes into gps locations using the google api. I also have alternative routes and the onReRoutingStarted() event of the SKNavigationListener is working right. However, I have a problem with onDestinationReached() - it seems like it does not get called when I reach my destination so my navigation does not stop. So if I keep driving and pass the destination point the app starts rerouting me again. Is there an issue with the onDestinationReached() or any special requirements when implementing it?
I thought it should work because it successfully calculates the route in the first place so it should know the destination point and I shouldnt have to specify it in any other way. But the method does not get called by the app when I reach the end of the route.
I have also encountered another issue with the SKNavigationListener events - onUpdateNavigationState(SKNavigationState navigationState). Inside the method I am trying to obtain some of the information the SKNavigationState object should be able to provide me with. The problems are as follows:
Eclipse cannot recognise the method getDistanceToDestination() - acts as if it is not defined inside the class SKNavigationState.
getCurrentAdviceCurrentStreetName() returns null
As far as I understand getCurrentAdviceDistanceToAdvice() should give me the distance to the point where I will receive another advice and getCurrentAdviceDistanceToDestination() should give me the remaining distance to the end point of the route. Both methods are supposed to return the distance in meters but they provide me with some really large numbers (more than a billion) when my route is only 5 kilometers long. Also, sometimes they return 0.
The onUpdateNavigationState(SKNavigationState navigation state) is supposed to get called multiple times while following the route and every time provide me with new information about the state of my navigation. It does get called multiple times but when I use the above methods they keep returning the same values (if I restart the application the values change but during a single test they give me the same values).
If anyone has any clue what could be going wrong. It is really confusing because I can successfully get the current speed from the SKNavigationState object using getCurrentSpeed(). But somehow some of the methods seem to not exist and others return values that dont make sense.
This issue was a bug on the 2.0.2 SDK version - it was fixed in vs 2.1.0 (which should be out on the 30'th of June 2014)

Categories

Resources