本文整理汇总了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);
}