本文整理汇总了Java中com.mapbox.mapboxsdk.MapboxAccountManager.start方法的典型用法代码示例。如果您正苦于以下问题:Java MapboxAccountManager.start方法的具体用法?Java MapboxAccountManager.start怎么用?Java MapboxAccountManager.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mapbox.mapboxsdk.MapboxAccountManager
的用法示例。
在下文中一共展示了MapboxAccountManager.start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
MapboxAccountManager.start(this, getString(R.string.PUBLIC_TOKEN));
Stetho.initializeWithDefaults(this);
}
示例2: onCreate
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapboxAccountManager.start(this, getString(R.string.access_token));
setContentView(R.layout.activity_main);
locationServices = LocationServices.getLocationServices(MainActivity.this);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
// Check if user has granted location permission. If they haven't, we request it
// otherwise we enable location tracking.
if (!locationServices.areLocationPermissionsGranted()) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocationTracking();
}
}
});
imageButton = (ImageButton) findViewById(R.id.btnPokeball);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(MainActivity.this)
.setTitle("MONSTER CAUGHT!")
.setPositiveButton("OK", null)
.show();
}
});
}
示例3: onCreate
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapboxAccountManager.start(this, getString(R.string.access_token));
setContentView(R.layout.activity_main);
// Create a mapView
mapView = (MapView) findViewById(R.id.mapview);
mapView.onCreate(savedInstanceState);
// Add a MapboxMap
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// Customize map with markers, polylines, etc.
// Local Style JSON in the Android `assets` folder
// mapboxMap.setStyleUrl("asset://mapbox-raster-v8.json");
mapboxMap.setStyleUrl("asset://styles/geography-class-local.json");
// Style JSON hosted on a server
// mapboxMap.setStyleUrl("https://www.mapbox.com/android-sdk/files/mapbox-raster-v8.json");
// Examples of built in Mapbox Styles
// mapboxMap.setStyleUrl(Style.MAPBOX_STREETS);
// mapboxMap.setStyleUrl(Style.OUTDOORS);
// mapboxMap.setStyleUrl(Style.LIGHT);
// mapboxMap.setStyleUrl(Style.DARK);
}
});
}
示例4: onCreate
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
MapboxAccountManager.start(this, getString(R.string.PUBLIC_TOKEN));
}
示例5: onCreateView
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
MapboxAccountManager.start(getActivity(), "pk.eyJ1IjoibWV0aW5rYWxlMzgiLCJhIjoiY2lyaHF1dW1uMDAzemlnbmtlN3plbXN3ZiJ9.t2c0KnfotdunLL--tj0NCA");
return inflater.inflate(R.layout.compass_map, container, false);
}
示例6: onCreate
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token only needs to be configured once in the app
MapboxAccountManager.start(this, this.getString(R.string.keychain_mapbox_access_token));
// Set Content View
// This contains the MapView in XML and needs to be called after the account manager
setContentView(R.layout.sg_activity_map);
// Bind Views
ButterKnife.bind(this);
// Check if GPS is enabled and if not send user to the GSP settings
// TODO Better solution would be to display a dialog and suggesting to go to the settings
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
boolean enabledGPS = service.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!enabledGPS) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
// Create an instance of GoogleAPIClient.
if (mGoogleApiClient == null) {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
// Initializing MapView
try {
this.mMapViewMain = (MapView) findViewById(R.id.mapviewMain);
this.mMapViewMain.onCreate(savedInstanceState);
this.mMapViewMain.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
mMap = mapboxMap;
// Customize map with markers, polylines, etc.
// TODO disable scrolling
}
});
} catch (Exception e) {
Log.e(this.getClass().getSimpleName(), e.getMessage());
}
// Save the resolving error boolean if present
mResolvingError = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
// Save the resolving settings boolean if present
mResolvingSettings = savedInstanceState != null
&& savedInstanceState.getBoolean(STATE_CHECKING_SETTINGS, false);
// Update location data
this.updateValuesFromBundle(savedInstanceState);
}
示例7: onCreate
import com.mapbox.mapboxsdk.MapboxAccountManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
Fabric.with(this, new Crashlytics());
// Init Stetho for debug purpose (database)
Stetho.initializeWithDefaults(this);
// Init Dagger
osmTemplateComponent = DaggerOsmTemplateComponent.builder().osmTemplateModule(new OsmTemplateModule(this)).build();
osmTemplateComponent.inject(this);
// Init Flickr object
StoreConfigManager configManager = new StoreConfigManager();
flickr = new Flickr(configManager.getFlickrApiKey(), configManager.getFlickrApiKeySecret(), new REST());
// Cache Disk for Fresco
DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this)
.setBaseDirectoryPath(new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), getPackageName()))
.setBaseDirectoryName("images")
.build();
// Cache Memory for Fresco
ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
.setBitmapMemoryCacheParamsSupplier(new Supplier<MemoryCacheParams>() {
@Override
public MemoryCacheParams get() {
return new MemoryCacheParams(10485760, 100, 100, 100, 100);
}
})
.setMainDiskCacheConfig(diskCacheConfig)
.build();
// Init Fresco
Fresco.initialize(this, imagePipelineConfig);
// Init event bus
EventBus bus = osmTemplateComponent.getEventBus();
bus.register(getOsmTemplateComponent().getLoginManager());
bus.register(getOsmTemplateComponent().getEditPoiManager());
bus.register(getOsmTemplateComponent().getPoiManager());
bus.register(getOsmTemplateComponent().getNoteManager());
bus.register(getOsmTemplateComponent().getSyncManager());
bus.register(getOsmTemplateComponent().getTypeManager());
bus.register(getOsmTemplateComponent().getPresetsManager());
bus.register(getOsmTemplateComponent().getGeocoder());
bus.register(getOsmTemplateComponent().getEditVectorialWayManager());
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.shared_prefs_preset_default), false)) {
editor.putBoolean(getString(R.string.shared_prefs_preset_default), true);
}
editor.apply();
MapboxAccountManager.start(this, BuildConfig.MAPBOX_TOKEN);
}