protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_mock_navigation); Cheeseknife.Bind(this); routeRefresh = new RouteRefresh(Mapbox.Mapboxsdk.Mapbox.AccessToken, this); mapView.OnCreate(savedInstanceState); mapView.GetMapAsync(this); Context context = ApplicationContext; CustomNavigationNotification customNotification = new CustomNavigationNotification(context); MapboxNavigationOptions options = MapboxNavigationOptions.InvokeBuilder() .NavigationNotification(customNotification) .Build(); navigation = new Mapbox.Services.Android.Navigation.V5.Navigation.MapboxNavigation(this, Mapbox.Mapboxsdk.Mapbox.AccessToken, options); var builder = new RouteMilestone.Builder(); builder.SetIdentifier(BEGIN_ROUTE_MILESTONE); builder.SetInstruction(new BeginRouteInstruction()); builder.SetTrigger( Trigger.All( Trigger.Lt(TriggerProperty.StepIndex, 3), Trigger.Gt(TriggerProperty.StepDistanceTotalMeters, 200), Trigger.Gte(TriggerProperty.StepDistanceTraveledMeters, 75) ) ); navigation.AddMilestone(builder.Build()); customNotification.Register(new MyBroadcastReceiver(navigation), context); }
protected override void OnCreate(Bundle savedInstanceState) { SetTheme(Resource.Style.NavigationViewLight); base.OnCreate(savedInstanceState); callback = new RerouteActivityLocationCallback(this); SetContentView(Resource.Layout.activity_reroute); Cheeseknife.Bind(this); mapView.OnCreate(savedInstanceState); mapView.GetMapAsync(this); MapboxNavigationOptions options = MapboxNavigationOptions.InvokeBuilder().IsDebugLoggingEnabled(true).Build(); navigation = new Mapbox.Services.Android.Navigation.V5.Navigation.MapboxNavigation(ApplicationContext, Mapbox.Mapboxsdk.Mapbox.AccessToken, options); navigation.AddNavigationEventListener(this); navigation.AddMilestoneEventListener(this); AddNavigationForHistory(navigation); instructionView.RetrieveSoundButton().Show(); instructionView.RetrieveSoundButton().AddOnClickListener(new InstructionViewOnClickListener((v) => { Toast.MakeText(this, "Sound button clicked!", ToastLength.Short).Show(); })); }
private void InitializeNavigation(MapboxMap mapboxMap) { navigation = new Mapbox.Services.Android.Navigation.V5.Navigation.MapboxNavigation(this, Mapbox.Mapboxsdk.Mapbox.AccessToken); navigation.LocationEngine = locationEngine; sendAnomalyFab.Show(); navigation.CameraEngine = new DynamicCamera(mapboxMap); navigation.AddProgressChangeListener(this); navigation.AddMilestoneEventListener(this); navigation.AddOffRouteListener(this); navigationMap.AddProgressChangeListener(navigation); AddNavigationForHistory(navigation); }
public MyBroadcastReceiver(Mapbox.Services.Android.Navigation.V5.Navigation.MapboxNavigation navigation) { weakNavigation = new WeakReference <Mapbox.Services.Android.Navigation.V5.Navigation.MapboxNavigation>(navigation); }