本文整理汇总了Java中com.mapzen.android.lost.api.LocationServices.FusedLocationApi方法的典型用法代码示例。如果您正苦于以下问题:Java LocationServices.FusedLocationApi方法的具体用法?Java LocationServices.FusedLocationApi怎么用?Java LocationServices.FusedLocationApi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mapzen.android.lost.api.LocationServices
的用法示例。
在下文中一共展示了LocationServices.FusedLocationApi方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDestroy
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Override
public void onDestroy() {
app.activateMoveMapToLocation();
teardownLinedrawing();
markReadyForUpload();
mapController.clearLines();
act.updateView();
bus.unregister(this);
showLocateButton();
if (LocationServices.FusedLocationApi != null) {
LocationServices.FusedLocationApi.setMockMode(false);
}
super.onDestroy();
}
示例2: setup
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Before
public void setup() {
application = (MapzenApplication) Robolectric.application;
application.inject(this);
LocationServices.FusedLocationApi = null;
mapController.setActivity(TestHelper.initBaseActivity());
listener = new MapzenLocation.Listener(application);
}
示例3: shouldSetDefaultLocationUpdateInterval
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Test
public void shouldSetDefaultLocationUpdateInterval() throws Exception {
FusedLocationProviderApi api = Mockito.mock(FusedLocationProviderApi.class);
LocationServices.FusedLocationApi = api;
ArgumentCaptor<LocationRequest> argument = ArgumentCaptor.forClass(LocationRequest.class);
onLocationServicesConnected(mapController, api, application);
verify(api).requestLocationUpdates(argument.capture(), any(LocationListener.class));
assertThat(argument.getValue().getInterval()).isEqualTo(1000);
}
示例4: shouldSetCustomLocationUpdateInterval
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Test
public void shouldSetCustomLocationUpdateInterval() throws Exception {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(application);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(application.getString(R.string.settings_location_update_interval_key), 2000);
editor.commit();
FusedLocationProviderApi api = Mockito.mock(FusedLocationProviderApi.class);
LocationServices.FusedLocationApi = api;
ArgumentCaptor<LocationRequest> argument = ArgumentCaptor.forClass(LocationRequest.class);
onLocationServicesConnected(mapController, api, application);
verify(api).requestLocationUpdates(argument.capture(), any(LocationListener.class));
assertThat(argument.getValue().getInterval()).isEqualTo(2000);
}
示例5: onLocationServicesConnected_shouldSetPriority
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Test
public void onLocationServicesConnected_shouldSetPriority() throws Exception {
FusedLocationProviderApi api = Mockito.mock(FusedLocationProviderApi.class);
LocationServices.FusedLocationApi = api;
ArgumentCaptor<LocationRequest> argument = ArgumentCaptor.forClass(LocationRequest.class);
onLocationServicesConnected(mapController, api, application);
verify(api).requestLocationUpdates(argument.capture(), any(LocationListener.class));
assertThat(argument.getValue().getPriority()).isEqualTo(PRIORITY_HIGH_ACCURACY);
}
示例6: onCreateView
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.route_widget, container, false);
ButterKnife.inject(this, rootView);
fragment = this;
adapter = new RouteAdapter(act, instructions, fragment);
adapter.setDestinationName(simpleFeature.getProperty(TEXT));
TextView destinationName = (TextView) rootView.findViewById(R.id.destination_name);
destinationName.setText(getString(R.string.routing_to_text) + simpleFeature
.getProperty(TEXT));
if (route != null) {
distanceToDestination.setDistance(route.getTotalDistance());
}
pager.setAdapter(adapter);
pager.setOnPageChangeListener(this);
adapter.notifyDataSetChanged();
currentXCor = mapFragment.getMap().getMapPosition().getX();
initSpeakerbox();
initNotificationCreator();
pager.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
turnAutoPageOff();
return false;
}
});
initDebugView(rootView);
initSlideLayout(rootView);
setMapOnTouchListener();
res = act.getResources();
prefs = getDefaultSharedPreferences(act);
if (LocationServices.FusedLocationApi != null) {
if (prefs.getBoolean(getString(R.string.settings_mock_gpx_key), false)) {
final String key = getString(R.string.settings_mock_gpx_filename_key);
final String defaultFile =
getString(R.string.settings_mock_gpx_filename_default_value);
final String filename = prefs.getString(key, defaultFile);
final File file = new File(Environment.getExternalStorageDirectory(),
filename);
LocationServices.FusedLocationApi.setMockMode(true);
LocationServices.FusedLocationApi.setMockTrace(file);
} else {
LocationServices.FusedLocationApi.setMockMode(false);
}
}
hideLocateButtonAndAttribution();
return rootView;
}
示例7: setTestLocationClient
import com.mapzen.android.lost.api.LocationServices; //导入方法依赖的package包/类
private void setTestLocationClient() {
LocationServices.FusedLocationApi = new TestFusedLocationProviderApiImpl(application);
}