本文整理匯總了Java中com.baidu.mapapi.SDKInitializer.initialize方法的典型用法代碼示例。如果您正苦於以下問題:Java SDKInitializer.initialize方法的具體用法?Java SDKInitializer.initialize怎麽用?Java SDKInitializer.initialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.baidu.mapapi.SDKInitializer
的用法示例。
在下文中一共展示了SDKInitializer.initialize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplicationContext());//在Application的onCreate()不行,必須在activity的onCreate()中
setContentView(R.layout.activity_main);
Log.d("gaolei", "MainActivity---------onCreate---------------");
setStatusBar();
initMap();
initView();
isServiceLive = Utils.isServiceWork(this, "com.biubike.service.RouteService");
if (isServiceLive)
beginService();
FragmentManager fm = getSupportFragmentManager();
mMenuFragment = (LeftMenuFragment) fm.findFragmentById(R.id.id_container_menu);
mLeftDrawerLayout.setOnMenuSlideListener(this);
if (mMenuFragment == null) {
fm.beginTransaction().add(R.id.id_container_menu, mMenuFragment = new LeftMenuFragment()).commit();
}
}
示例2: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
// 禁止默認的頁麵統計方式,這樣將不會再自動統計Activity(默認頁麵統計隻能統計Activity,不能統計Activity下麵包含的Fragment)
MobclickAgent.openActivityDurationTrack(false);
LogUtils.getLogConfig().configAllowLog(!IS_RELEASE_VERSION) // Log日誌開關
.configTagPrefix(getPackageName()) //設置Log日誌Tag前綴:用包名
.configShowBorders(true)
.configLevel(LogLevel.TYPE_VERBOSE);
if (IS_RELEASE_VERSION) {
MobclickAgent.setDebugMode(false); // 友盟統計SDK,集成測試開關
} else {
MobclickAgent.setDebugMode(true);
}
initImageLoader(this); // 初始化ImageLoader
SDKInitializer.initialize(this); // 初始化百度地圖-注意:在SDK各功能組件使用之前都需要調用,因此我們建議該方法放在Application的初始化方法中
}
示例3: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_running);
//acquireWakeLock();
initView();
initSettings();
checkGPS();
initMapLocation();
startButton.setOnClickListener(v -> {
if (runningStatus == 0) {
startRunning();
} else if (runningStatus == 1) {
new AlertDialog.Builder(RunningActivity.this)
.setTitle("結束跑步")
.setMessage("你確定要結束跑步嗎?")
.setPositiveButton("確定", (dialog, which) -> stopRunning())
.setNegativeButton("取消", null).create().show();
}
});
}
示例4: init
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
private void init() {
OSCSharedPreference.init(this, "osc_update_sp");
// 初始化異常捕獲類
AppCrashHandler.getInstance().init(this);
// 初始化賬戶基礎信息
AccountHelper.init(this);
// 初始化網絡請求
ApiHttpClient.init(this);
//初始化百度地圖
SDKInitializer.initialize(this);
DBManager.init(this);
if (OSCSharedPreference.getInstance().hasShowUpdate()) {//如果已經更新過
//如果版本大於更新過的版本,就設置彈出更新
if (BuildConfig.VERSION_CODE > OSCSharedPreference.getInstance().getUpdateVersion()) {
OSCSharedPreference.getInstance().putShowUpdate(true);
}
}
}
示例5: init
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
public static void init(Context context) {
//百度地圖初始化
SDKInitializer.initialize(context.getApplicationContext());
// 定位初始化
mLocClient = new LocationClient(context.getApplicationContext());
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打開gps
option.setCoorType("bd09ll"); // 設置坐標類型
option.setScanSpan(1000);
option.setIsNeedAddress(true);//可選,設置是否需要地址信息,默認不需要
option.setIsNeedLocationDescribe(true);//可選,默認false,設置是否需要位置語義化結果,可以在BDLocation.getLocationDescribe裏得到,結果類似於“在北京天安門附近”
option.setIsNeedLocationPoiList(true);//可選,默認false,設置是否需要POI結果,可以在BDLocation.getPoiList裏得到
mLocClient.setLocOption(option);;
haveInited=true;
}
示例6: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplicationContext());//必須放在這裏
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
myUser = MyApplication.getInstance().getUser();
if (myUser != null)
isNeedLogin = false;
else {
isNeedLogin = true;
}
Log.d(TAG, "initData: " + isNeedLogin);
initMap();
requesPemission();
initViews();
isServiceLive = Utils.isServiceWork(this, "com.yiwen.mobike.service.RouteService");
if (isServiceLive)
beginService();
initData();
initEvent();
}
示例7: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//初始化百度地圖SDK
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.cp_activity_city_list);
StatusBarCompat.setStatusBarColor(this,getResources().getColor(R.color.white));
//隱藏actionBar
ActionBar actionBar = getSupportActionBar();
if(actionBar != null){
actionBar.hide();
}
initData();
initView();
//聲明LocationClient類
mLocationClient = new LocationClient(getApplicationContext());
//注冊監聽函數
mLocationClient.registerLocationListener(myListener);
initLocation();
}
示例8: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
mContext = getApplicationContext();
//初始化 Bugly
CrashReport.initCrashReport(getApplicationContext(), StaticClass.BUGLY_APP_ID, true);
//初始化 Bmob
Bmob.initialize(this, StaticClass.BMOB_APP_ID);
//初始化語音識別
SpeechUtility.createUtility(getApplicationContext(), SpeechConstant.APPID + "=" +
StaticClass.VOICE_KEY);
//初始化百度地圖
SDKInitializer.initialize(getApplicationContext());
//初始化litepal
LitePalApplication.initialize(getApplicationContext());
}
示例9: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate() {
MultiDex.install(this);
super.onCreate();
instance = this;
aCache = ACache.get(this);
DemoHelper.getInstance().init(this);
SDKInitializer.initialize(this);
EMClient.getInstance().init(this, initChatOptions());
EMClient.getInstance().setDebugMode(true);
initRedPacket();
// F.setLog(false);
// //崩潰處理
CrashHandlerUtil crashHandlerUtil = CrashHandlerUtil.getInstance();
crashHandlerUtil.init(this);
crashHandlerUtil.setCrashTip("很抱歉,程序出現異常,即將退出!");
Config.DEBUG = true;
initUM();
QueuedWork.isUseThreadPool = false;
UMShareAPI.get(this);
}
示例10: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
// ��ʹ��SDK�����֮ǰ��ʼ��context��Ϣ������ApplicationContext
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_busline_online);
// ��ȡ�ؼ�
initViews();
// ���ü�����
setListeners();
}
示例11: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//在使用SDK各組件之前初始化context信息,傳入ApplicationContext
//注意該方法要再setContentView方法之前實現
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_location_baidu_map);
//獲取地圖控件引用
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
//普通地圖
// mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
//衛星地圖
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
//空白地圖, 基礎地圖瓦片將不會被渲染。在地圖類型中設置為NONE,將不會使用流量下載基礎地圖瓦片圖層。使用場景:與瓦片圖層一起使用,節省流量,提升自定義瓦片圖下載速度。
// mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NONE);
}
示例12: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
mApplicationContext = this;
/***
* 初始化版本升級模塊
*/
UpdateConfig.initGet(this);
/***
* 初始化定位sdk,建議在Application中創建
*/
locationService = new LocationService(getApplicationContext());
mVibrator = (Vibrator) getApplicationContext().getSystemService(VIBRATOR_SERVICE);
SDKInitializer.initialize(getApplicationContext());
}
示例13: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 以下這行代碼作用:消除標題欄,但會出現bug。會隱藏掉menu菜單。不用該代碼。
// requestWindowFeature(Window.FEATURE_NO_TITLE);
// 以下這行代碼作用:使地圖全屏顯示,隱藏狀態欄
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);
// 在使用SDK各組件之前初始化context信息,傳入ApplicationContext
// 注意該方法要再setContentView方法之前實現
SDKInitializer.initialize(getApplicationContext());
// 怎樣快速導入導入包的快捷鍵
// Ctrl+Shift+o
setContentView(R.layout.activity_map);// 加載主界麵,這個主界麵就是地圖界麵
this.context = this;
initView();
// 初始化定位
initLocation();
}
示例14: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate() {
SDKInitializer.initialize(getApplicationContext());
super.onCreate();
final Context context = getApplicationContext();
dpPrefs = new DroidPlannerPrefs(context);
lbm = LocalBroadcastManager.getInstance(context);
serviceMgr = new ServiceManager(context);
drone = new Drone(serviceMgr, handler);
missionProxy = new MissionProxy(context, this.drone);
exceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(dpExceptionHandler);
GAUtils.initGATracker(this);
GAUtils.startNewSession(context);
registerReceiver(broadcastReceiver, new IntentFilter(ACTION_TOGGLE_DRONE_CONNECTION));
}
示例15: onCreate
import com.baidu.mapapi.SDKInitializer; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
SDKInitializer.initialize(this);
SharedPreferences preferences = getSharedPreferences("LastLocation",Context.MODE_PRIVATE);
CURRENT_CITY = preferences.getString("currentCity", "西安市");
CURRENT_POSITION = preferences.getString("LastAddress", "");
preferences = null;
//開啟後台服務
Intent intent=new Intent(this,AlarmService.class);
startService(intent);
}