本文整理汇总了Java中com.baidu.mapapi.SDKInitializer类的典型用法代码示例。如果您正苦于以下问题:Java SDKInitializer类的具体用法?Java SDKInitializer怎么用?Java SDKInitializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SDKInitializer类属于com.baidu.mapapi包,在下文中一共展示了SDKInitializer类的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: onReceive
import com.baidu.mapapi.SDKInitializer; //导入依赖的package包/类
public void onReceive(Context context, Intent intent) {
String s = intent.getAction();
String st1 = getResources().getString(R.string.Network_error);
if (s.equals(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR)) {
String st2 = getResources().getString(R.string.please_check);
Toast.makeText(instance, st2, Toast.LENGTH_SHORT).show();
} else if (s.equals(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR)) {
Toast.makeText(instance, st1, Toast.LENGTH_SHORT).show();
}
}
示例5: 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);
}
}
}
示例6: 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;
}
示例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
public void onCreate() {
super.onCreate();
CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false);
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
SDKInitializer.initialize(this);
Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75");
Logger.addLogAdapter(new AndroidLogAdapter(){
@Override
public boolean isLoggable(int priority, String tag) {
return true;// TODO: 2017/6/5
}
});
sInstance = this;
initUser();
}
示例11: 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();
}
示例12: onReceive
import com.baidu.mapapi.SDKInitializer; //导入依赖的package包/类
public void onReceive(Context context, Intent intent) {
String s = intent.getAction();
System.out.println(TAG + ":action: " + s);
switch (s) {
case SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR:
System.out.println("key 验证出错! 请在 AndroidManifest.xml 文件中检查 key 设置");
isOk = false;
break;
case SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_OK:
System.out.println("key 验证成功! 功能可以正常使用");
isOk = true;
break;
case SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR:
System.out.println("网络出错");
isOk = false;
break;
}
}
示例13: onCreate
import com.baidu.mapapi.SDKInitializer; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
// 注册 SDK 广播监听者
IntentFilter iFilter = new IntentFilter();
iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_OK);
iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
mReceiver = new SDKReceiver();
registerReceiver(mReceiver, iFilter);
mLocationClient = new LocationClient(getApplicationContext());
mLocationClient.registerLocationListener(this);
initLocation();
}
示例14: 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_trans_online);
// ��ȡ�ؼ�
initViews();
// ���ü�����
setListeners();
}
示例15: 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();
}