maplibre / maplibre-navigation-android

Maplibre Navigation SDK for Android
MIT License
86 stars 44 forks source link

[No issue] Info about how to check if arrived or passed the destination #69

Closed moiatto closed 1 year ago

moiatto commented 1 year ago

In onMilestoneEvent I can check when a waypoint is passed with remainingWaypoints().

How can I check the Destination point? even just to stop navigation.

boldtrn commented 1 year ago

We use the the onMilestoneEvent in the Kurviger App, there is an arrival milestone, milestones are triggered for Banner Instructions (IIRC).

moiatto commented 1 year ago

OK, do you mean milestone.getIdentifier() ?

There is a list of identifier values?

boldtrn commented 1 year ago

How you want to implement this is your decision, IIRC you have a custom converter from OSMDroid, so this depends on what you add there.

moiatto commented 1 year ago

Ok. Thanks

moiatto commented 1 year ago

We use the the onMilestoneEvent in the Kurviger App, there is an arrival milestone, milestones are triggered for Banner Instructions (IIRC).

I tried a lot but without success.

Can you tell me what's wrong?

// Custom Milestone for DESTINATION
navigation.addMilestone(new RouteMilestone.Builder()
        .setIdentifier(200)
        .setTrigger(Trigger.all(
                            Trigger.eq(TriggerProperty.LAST_LEG, TriggerProperty.TRUE),
                            Trigger.eq(TriggerProperty.LAST_STEP, TriggerProperty.TRUE)
                    ))
        .build());

// Custom Milestone for WAYPOINT
navigation.addMilestone(new StepMilestone.Builder()
        .setIdentifier(100)
        .setTrigger(Trigger.eq(TriggerProperty.LAST_STEP, TriggerProperty.TRUE))
        .build());
moiatto commented 1 year ago

I also tried new BannerInstructionMilestone.Builder() but it always triggers