Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: SKMapsAndroid 2.5.1: updateAnnotation ignores location update when using annotationVi

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Neuer skobbler
    Join Date
    20.10.2015
    Posts
    7

    SKMapsAndroid 2.5.1: updateAnnotation ignores location update when using annotationVi

    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:

    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(Context.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:
    HTML Code:
    <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:
    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
    Last edited by aridane; 22.10.2015 at 13:28.

  2. #2
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    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. We'll have a closer look at your code to see what are the differences.

  3. #3
    Neuer skobbler
    Join Date
    20.10.2015
    Posts
    7
    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.

  4. #4
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    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.
    Last edited by Adela_Silvia; 09.11.2015 at 10:17.

  5. #5
    Neuer skobbler
    Join Date
    20.10.2015
    Posts
    7
    Quote Originally Posted by Adela_Silvia View Post
    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?

  6. #6
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Sorry, it was a mistake- our developer wanted to say that "updateAnnotationFromView does not handle position update, it only updates the existing custom view."

  7. #7
    Neuer skobbler
    Join Date
    20.10.2015
    Posts
    7
    So can you advise on what is the recommended code to update an annotation's position if it's not updateAnnotation?

  8. #8
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    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.

  9. #9
    Neuer skobbler
    Join Date
    20.10.2015
    Posts
    7
    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.

  10. #10
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    The existing plan is to release a new SDK by the end of Jan, 2016 (this fix was included for that release)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •