PDA

View Full Version : SKMapsAndroid 2.5.1: updateAnnotation ignores location update when using annotationVi



aridane
22.10.2015, 12:59
I am using SKMaps 2.5.1 on Android and have a usecase where I show about 10-20 icons on a map which represent moving objects in the vicinity of the user. Locations are updated about 10x per second for each of these.

I can create annotations with an annotation type, for instance SK_ANNOTATION_TYPE_RED, add them to the map using addAnnotation; then when a location update comes in I update the existing annotation object and call updateAnnotation and see my annotations moving around.

Now I want to use custom icons so I've created a layout and inflate it, then assign it to an annotationView. However, when I do this, the updateAnnotation call no longer updates the location of the icons on the map.

To create the annotation, I use the following code:


final SKAnnotation annotation = new SKAnnotation(mi.getId());
annotation.setLocation(new SKCoordinate(mi.getLon(), mi.getLat()));
annotation.setMininumZoomLevel(0);

final SKAnnotationView annotationView = new SKAnnotationView();
View customView =(RelativeLayout) ((LayoutInflater)getActivity().getSystemService(Co ntext.LAYOUT_INFLATER_SERVICE)).inflate(
R.layout.map_item, null, false);
final ImageView img = (ImageView) customView.findViewById(R.id.img);

img.setImageResource(R.drawable.some_image);
annotationView.setView(customView);
annotation.setAnnotationView(annotationView);

mapView.addAnnotation(annotation, SKAnimationSettings.ANIMATION_NONE);

My mapitem layout is:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="32dp"
android:layout_height="32dp">
<ImageView
android:id="@+id/img"
android:layout_width="32dp"
android:layout_height="32dp" />
</RelativeLayout>

To update an annotation location, I use the following code:

final SKAnnotation annotation = mAnnotationForMapItemId.get(mi.getId());

annotation.setLocation(new SKCoordinate(mi.getLon(), mi.getLat()));
mapView.updateAnnotation(annotation);

I can see the icons appear on the map correctly, in the locations where I expect them, but their location updates are being ignored. Am I forgetting something that is specific to annotations with custom views or is this a bug?

If anybody could advise, I would be grateful.


Gerard

Adela_Silvia
23.10.2015, 16:16
We've tested the behavior in debugKit and there are no issues there. updateAnnotation is working as expected- For activating the debugKit check this thread (http://forum.skobbler.com/showthread.php/7249-Turn-on-quot-Features-quot-option-for-debuging-on-AndroidDemo-project-%282-5-1%29). We'll have a closer look at your code to see what are the differences.

aridane
27.10.2015, 14:27
Thank you for looking into this Adela_Silvia.

For me the debugkit updateAnnotation in the example project also works. The main differences I've seen is that setAnnotationType is also called in the debugkit, and setOffset is called. I've added both to my code, but this does not change anything. I will also dive deeper to see if I can find any other differences that may cause this.

Adela_Silvia
06.11.2015, 12:10
Hi Aridane,

I have the confirmation from our developers that addAnnotationFromView does not handle position update, it only updates the existing custom view. This is the way it was implemented, there's no bug here.

aridane
06.11.2015, 17:59
Hi Aridane,

I have the confirmation from our developers that addAnnotationFromView does not handle position update, it only updates the existing custom view. This is the way it was implemented, there no bug here.

But I'm not calling that method, I'm calling updateAnnotation, and I would expect that one to take the updated position into account?

Adela_Silvia
09.11.2015, 10:30
Sorry, it was a mistake- our developer wanted to say that "updateAnnotationFromView does not handle position update, it only updates the existing custom view."

aridane
12.11.2015, 13:52
So can you advise on what is the recommended code to update an annotation's position if it's not updateAnnotation?

Adela_Silvia
16.11.2015, 17:12
It seems o Android there is a limitation and it's not possible to update an annotation's position like on iOS. We'll add this improvement in the next releases.

aridane
18.11.2015, 16:33
That's unfortunate, but thank you for investigating Adela_Silvia.

aridane
23.11.2015, 17:13
To get back to this subject: Could you indicate a timeframe for the availability of this feature? We are currently deciding on which mapping framework to use, and while there is no big rush to replace our current mapping product, we are aiming to make our final decision somewhere in January of 2016. It would be good if this feature were available around that time since feature-wise Skobbler is our preferred solution.

Adela_Silvia
03.12.2015, 15:30
The existing plan is to release a new SDK by the end of Jan, 2016 (this fix was included for that release)

aridane
28.01.2016, 17:44
I know January is not over yet, but any news on the new SDK version?

Adela_Silvia
04.02.2016, 16:06
Unfortunately, the support requests from the enterprise partners kept us from releasing on time the 3.0 build.
While dealing with the enterprise requests we are working also on the new builds. We hope to have the iOS version ready at the end of February, following to release after that the Android version