本文整理汇总了Java中com.mapbox.services.android.telemetry.location.LocationEngine类的典型用法代码示例。如果您正苦于以下问题:Java LocationEngine类的具体用法?Java LocationEngine怎么用?Java LocationEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocationEngine类属于com.mapbox.services.android.telemetry.location包,在下文中一共展示了LocationEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Before
public void setup() throws IOException {
MockitoAnnotations.initMocks(this);
navigation = new MapboxNavigation(mock(Context.class), ACCESS_TOKEN, mock(NavigationTelemetry.class),
mock(LocationEngine.class));
navigationEventDispatcher = navigation.getEventDispatcher();
Gson gson = new GsonBuilder()
.registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create();
String body = loadJsonFixture(PRECISION_6);
DirectionsResponse response = gson.fromJson(body, DirectionsResponse.class);
route = response.routes().get(0);
routeProgress = RouteProgress.builder()
.stepDistanceRemaining(100)
.legDistanceRemaining(100)
.distanceRemaining(100)
.directionsRoute(route)
.stepIndex(0)
.legIndex(0)
.build();
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:22,代码来源:NavigationEventDispatcherTest.java
示例2: onMapReady
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Override
public void onMapReady(final MapboxMap mapboxMap) {
LocationEngine locationEngine = new LostLocationEngine(this);
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, locationEngine);
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
locationLayerPlugin.addCompassListener(new CompassListener() {
@Override
public void onCompassChanged(float userHeading) {
CameraPosition cameraPosition = new CameraPosition.Builder().bearing(userHeading).build();
mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
@Override
public void onCompassAccuracyChange(int compassStatus) {
System.out.println(compassStatus);
}
});
}
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:19,代码来源:CompassListenerActivity.java
示例3: activateMockLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
/**
* Activates a new {@link MockLocationEngine} with the given
* {@link DirectionsRoute}.
*
* @param route to be mocked
*/
private void activateMockLocationEngine(DirectionsRoute route) {
LocationEngine locationEngine = new MockLocationEngine(1000, 30, false);
((MockLocationEngine) locationEngine).setRoute(route);
locationEngine.activate();
this.locationEngine.setValue(locationEngine);
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:13,代码来源:LocationViewModel.java
示例4: initialize
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
void initialize(@NonNull Context context, @NonNull String accessToken,
MapboxNavigation navigation, LocationEngine locationEngine) {
if (!isInitialized) {
// Initial session state
navigationSessionState = SessionState.builder().build();
// Setup the location engine
updateLocationEngine(locationEngine);
validateAccessToken(accessToken);
// Setup the listeners
initEventDispatcherListeners(navigation);
MapboxNavigationOptions options = navigation.options();
// Set sdkIdentifier based on if from UI or not
String sdkIdentifier = updateSdkIdentifier(options);
// Enable extra logging in debug mode
MapboxTelemetry.getInstance().setDebugLoggingEnabled(options.isDebugLoggingEnabled());
updateUserAgent(context, accessToken, sdkIdentifier);
// Get the current vendorId
vendorId = obtainVendorId(context);
NavigationMetricsWrapper.sdkIdentifier = sdkIdentifier;
NavigationMetricsWrapper.turnstileEvent();
// TODO This should be removed when we figure out a solution in NavigationTelemetry
// Force pushing a TYPE_MAP_LOAD event to ensure that the Nav turnstile event is sent
MapboxTelemetry.getInstance().pushEvent(MapboxEvent.buildMapLoadEvent());
isInitialized = true;
}
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:36,代码来源:NavigationTelemetry.java
示例5: updateLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
/**
* Called during {@link NavigationTelemetry#initialize(Context, String, MapboxNavigation, LocationEngine)}
* and any time {@link MapboxNavigation} gets an updated location engine.
* <p>
* Removes the current location engine listener if it exists, then
* sets up the new one / updates the location engine name.
*
* @param locationEngine to be used to update
*/
void updateLocationEngine(LocationEngine locationEngine) {
// Remove listener from previous engine
if (navigationLocationEngine != null) {
navigationLocationEngine.removeLocationEngineListener(this);
}
// Store the new engine and setup a new listener
if (locationEngine != null) {
navigationLocationEngine = locationEngine;
navigationLocationEngine.addLocationEngineListener(this);
String locationEngineName = locationEngine.getClass().getName();
navigationSessionState.toBuilder().locationEngineName(locationEngineName);
}
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:24,代码来源:NavigationTelemetry.java
示例6: MapboxNavigation
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
MapboxNavigation(@NonNull Context context, @NonNull String accessToken,
@NonNull MapboxNavigationOptions options, NavigationTelemetry navigationTelemetry,
LocationEngine locationEngine) {
this.accessToken = accessToken;
this.context = context;
this.options = options;
this.navigationTelemetry = navigationTelemetry;
this.locationEngine = locationEngine;
initialize();
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:11,代码来源:MapboxNavigation.java
示例7: obtainLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
private LocationEngine obtainLocationEngine() {
if (locationEngine == null) {
return new LostLocationEngine(context);
}
return locationEngine;
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:8,代码来源:MapboxNavigation.java
示例8: sanityTest
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void sanityTest() {
assertNotNull("should not be null", navigation);
MapboxNavigationOptions options = MapboxNavigationOptions.builder().build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
assertNotNull("should not be null", navigationWithOptions);
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:9,代码来源:MapboxNavigationTest.java
示例9: defaultMilestones_onInitializationDoNotGetAdded
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void defaultMilestones_onInitializationDoNotGetAdded() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
assertEquals(0, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:8,代码来源:MapboxNavigationTest.java
示例10: addMilestone_milestoneOnlyGetsAddedOnce
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void addMilestone_milestoneOnlyGetsAddedOnce() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
Milestone milestone = new StepMilestone.Builder().build();
navigationWithOptions.addMilestone(milestone);
navigationWithOptions.addMilestone(milestone);
assertEquals(1, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:11,代码来源:MapboxNavigationTest.java
示例11: removeMilestone_milestoneDidGetRemoved
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void removeMilestone_milestoneDidGetRemoved() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
Milestone milestone = new StepMilestone.Builder().build();
navigationWithOptions.addMilestone(milestone);
assertEquals(1, navigationWithOptions.getMilestones().size());
navigationWithOptions.removeMilestone(milestone);
assertEquals(0, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:12,代码来源:MapboxNavigationTest.java
示例12: removeMilestone_milestoneDoesNotExist
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void removeMilestone_milestoneDoesNotExist() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
Milestone milestone = new StepMilestone.Builder().build();
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
navigationWithOptions.removeMilestone(milestone);
assertEquals(1, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:11,代码来源:MapboxNavigationTest.java
示例13: removeMilestone_nullRemovesAllMilestones
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void removeMilestone_nullRemovesAllMilestones() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
assertEquals(4, navigationWithOptions.getMilestones().size());
navigationWithOptions.removeMilestone(null);
assertEquals(0, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:14,代码来源:MapboxNavigationTest.java
示例14: removeMilestone_correctMilestoneWithIdentifierGetsRemoved
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void removeMilestone_correctMilestoneWithIdentifierGetsRemoved() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
Milestone milestone = new StepMilestone.Builder().setIdentifier(5678).build();
navigationWithOptions.addMilestone(milestone);
assertEquals(1, navigationWithOptions.getMilestones().size());
navigationWithOptions.removeMilestone(5678);
assertEquals(0, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:12,代码来源:MapboxNavigationTest.java
示例15: removeMilestone_noMilestoneWithIdentifierFound
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void removeMilestone_noMilestoneWithIdentifierFound() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class),
ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
assertEquals(1, navigationWithOptions.getMilestones().size());
navigationWithOptions.removeMilestone(5678);
assertEquals(1, navigationWithOptions.getMilestones().size());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:11,代码来源:MapboxNavigationTest.java
示例16: getLocationEngine_returnsCorrectLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
@Test
public void getLocationEngine_returnsCorrectLocationEngine() throws Exception {
LocationEngine locationEngine = mock(LocationEngine.class);
LocationEngine locationEngine2 = mock(LocationEngine.class);
navigation.setLocationEngine(locationEngine);
assertNotSame(locationEngine2, navigation.getLocationEngine());
assertEquals(locationEngine, navigation.getLocationEngine());
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:9,代码来源:MapboxNavigationTest.java
示例17: getLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
public static synchronized LocationEngine getLocationEngine(Context context) {
if (instance == null) {
instance = new GoogleLocationEngine(context.getApplicationContext());
}
return instance;
}
开发者ID:mapbox,项目名称:mapbox-navigation-hud-demo,代码行数:8,代码来源:GoogleLocationEngine.java
示例18: LocationLayerPlugin
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
/**
* Construct a {@code LocationLayerPlugin}
*
* @param mapView the MapView to apply the My Location layer plugin to
* @param mapboxMap the MapboxMap to apply the My Location layer plugin with
* @param locationEngine the {@link LocationEngine} this plugin should use to update
* @param styleRes customize the user location icons inside your apps {@code style.xml}
* @since 0.1.0
*/
public LocationLayerPlugin(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap,
@Nullable LocationEngine locationEngine, @StyleRes int styleRes) {
this.locationEngine = locationEngine;
this.mapboxMap = mapboxMap;
this.mapView = mapView;
this.styleRes = styleRes;
mapView.addOnMapChangedListener(this);
initialize();
}
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:19,代码来源:LocationLayerPlugin.java
示例19: setLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
/**
* The {@link LocationEngine} the plugin will use to update it's position. If {@code null} is
* passed in, all updates will occur through the
* {@link LocationLayerPlugin#forceLocationUpdate(Location)} method.
*
* @param locationEngine a {@link LocationEngine} this plugin should use to handle updates
* @since 0.1.0
*/
@SuppressWarnings( {"MissingPermission"})
public void setLocationEngine(@Nullable LocationEngine locationEngine) {
if (locationEngine != null) {
this.locationEngine = locationEngine;
setLocationLayerEnabled(locationLayerMode);
} else if (this.locationEngine != null) {
this.locationEngine.removeLocationEngineListener(this);
this.locationEngine = null;
}
}
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:19,代码来源:LocationLayerPlugin.java
示例20: updateLocationEngine
import com.mapbox.services.android.telemetry.location.LocationEngine; //导入依赖的package包/类
void updateLocationEngine(LocationEngine locationEngine) {
navigation.setLocationEngine(locationEngine);
}
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:4,代码来源:NavigationViewModel.java
注:本文中的com.mapbox.services.android.telemetry.location.LocationEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论