Java Code Examples for com.baidu.mapapi.SDKInitializer#initialize()

The following examples show how to use com.baidu.mapapi.SDKInitializer#initialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BusActivity.java    From BaiduMap-TrafficAssistant with MIT License 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	SDKInitializer.initialize(getApplicationContext());
	setContentView(R.layout.activity_bus);
	this.context = this;

	initView();// 省市联动;
	initAdapter();// 省市联动;
	province.setAdapter(arrayAdapterProvince);

	mBaiduMap = ((SupportMapFragment) getSupportFragmentManager()
			.findFragmentById(R.id.bmapView)).getBaiduMap();
	mSearch = PoiSearch.newInstance();
	mBusLineSearch = BusLineSearch.newInstance();
	initListener();
	busLineIDList = new ArrayList<String>();

}
 
Example 2
Source File: ShareLocationActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SDKInitializer.initialize(getApplicationContext());
    shareId = getIntent().getStringExtra(SHARE_ID);
    fromId = getIntent().getStringExtra(FROM_ID);
    myId = QtalkStringUtils.userId2Jid(CurrentPreference.getInstance().getUserid());
    presenter.setShareLocationView(this);
    setContentView(R.layout.atom_ui_activity_share_location);
    mapView = (MapView) findViewById(R.id.mapView);
    img_reset_location = (ImageView) findViewById(R.id.img_reset_location);
    hint = (TextView) findViewById(R.id.hint);
    topContainer = (LinearLayout) findViewById(R.id.location_top_container);
    actionBar = (QtNewActionBar) findViewById(R.id.my_action_bar);
    setNewActionBar(actionBar);
    initBaiduMap();
    img_reset_location.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            zoomMap();
        }
    });
    addMember(myId);
}
 
Example 3
Source File: ExampleApp.java    From FastWaiMai with MIT License 6 votes vote down vote up
/**
 * 访问本机地址须使用IP地址访问无法使用localhost形式
 */
@Override
public void onCreate() {
    super.onCreate();
    final ArrayList<Interceptor> interceptors = initInterceptors();

    Latte.init(this)
            .withApiHost("http://192.168.1.54:8082")
            .withInterceptors(interceptors)
            .withIcon(new FontAwesomeModule())
            .withJavascriptInterface("latte")
            .withWebEvent("test",new TestEvent())
            .configure();
    //在使用SDK各组件之前初始化context信息,传入ApplicationContext
    SDKInitializer.initialize(this);
    //自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
    //包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
    SDKInitializer.setCoordType(CoordType.BD09LL);
 Fragmentation.builder()
   // 显示悬浮球 ; 其他Mode:SHAKE: 摇一摇唤出   NONE:隐藏
   .stackViewMode(Fragmentation.SHAKE)
   .debug(BuildConfig.DEBUG)
            .install();

}
 
Example 4
Source File: JGApplication.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    StorageUtil.init(context, null);

    Fresco.initialize(getApplicationContext());
    SDKInitializer.initialize(getApplicationContext());
    locationService = new LocationService(getApplicationContext());

    JMessageClient.init(getApplicationContext(), true);
    JMessageClient.setDebugMode(true);
    SharePreferenceManager.init(getApplicationContext(), JCHAT_CONFIGS);
    //设置Notification的模式
    JMessageClient.setNotificationFlag(JMessageClient.FLAG_NOTIFY_WITH_SOUND | JMessageClient.FLAG_NOTIFY_WITH_LED | JMessageClient.FLAG_NOTIFY_WITH_VIBRATE);
    //注册Notification点击的接收器
    new NotificationClickEventReceiver(getApplicationContext());
    initImagePicker();

}
 
Example 5
Source File: NearbyGroupWithRedPocketMapViewActivity.java    From Social with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SDKInitializer.initialize(getApplicationContext());
    setContentView(R.layout.nearby_group_with_redpocket_mapview_activity_layout);

    is_first_page = getIntent().getIntExtra("is_first_page",0);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_RED_POCKET_GROUP:
                    handleRedpocketGroupList(msg);
                    break;
            }
        }
    };

    initView();

    getRedPocketGroupList();

}
 
Example 6
Source File: MapActivity.java    From BaiduMap-TrafficAssistant with MIT License 6 votes vote down vote up
@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();

}
 
Example 7
Source File: MainApplication.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    //初始化百度地图
    //在使用SDK各组件之前初始化context信息,传入ApplicationContext
    //注意该方法要再setContentView方法之前实现
    SDKInitializer.initialize(getApplicationContext());


}
 
Example 8
Source File: NavigationActivity.java    From BaiduMap-TrafficAssistant with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	SDKInitializer.initialize(getApplicationContext());
	this.context = this;
	setContentView(R.layout.activity_navigation);
	initView();

	// 初始化搜索模块,注册事件监听
	mSearch = GeoCoder.newInstance();
	mSearch.setOnGetGeoCodeResultListener(this);
}
 
Example 9
Source File: MapService.java    From MapForTour with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
  Log.d("lml", "MapService:onCreate");
  super.onCreate();
  SDKInitializer.initialize(getApplicationContext());
  application = (DeviceMessageApplication) getApplication();
  initializeService();
  mLocationClient.start();
}
 
Example 10
Source File: FreightTrackMapActivity.java    From ESeal with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //初始化百度地图API
        SDKInitializer.initialize(getApplicationContext());

        setContentView(R.layout.activity_toolbar_frame_fab);

        mFreight = getIntent().getParcelableExtra(EXTRA_FREIGHT);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(mFreight.getName());
        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

//        attachDeviceFragment();
//        attachDeviceGoogleMapFragment(); //test GoogleMap
        attachDeviceWithWebViewFragment(); //using WebView & BaiduMap

        supportPostponeEnterTransition();
    }
 
Example 11
Source File: MyApplication.java    From foodie-app with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    //创建默认的ImageLoader配置参数
    ImageLoaderConfiguration configuration = ImageLoaderConfiguration
            .createDefault(this);

    //Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(configuration);
    //在使用SDK各组件之前初始化context信息,传入ApplicationContext
    //注意该方法要再setContentView方法之前实现
    SDKInitializer.initialize(getApplicationContext());
}
 
Example 12
Source File: InitApplication.java    From BaiduMap-TrafficAssistant with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
	super.onCreate();
	// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
	SDKInitializer.initialize(getApplicationContext());

}
 
Example 13
Source File: MainActivity.java    From Android-Plugin-Framework with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //appkey是使用插件的packageName注册的
    //sdk的配置信息也在插件中
    SDKInitializer.initialize(getApplication());

    setContentView(R.layout.activity_main);

    mMapView = (MapView) findViewById(R.id.bmapView);
}
 
Example 14
Source File: MainActivity.java    From MoveMapLocation with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //在使用SDK各组件之前初始化context信息,传入ApplicationContext
    //注意该方法要再setContentView方法之前实现
    SDKInitializer.initialize(getApplicationContext());
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    initView();
}
 
Example 15
Source File: FriendLocationActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SDKInitializer.initialize(MyApplication.mContext);
    setContentView(R.layout.friend_location_activity_layout);

    intentFilter = new IntentFilter("com.allever.social.update_friend_location");
    acceptFriendLocationReceiver = new AcceptFriendLocationReceiver();
    this.registerReceiver(acceptFriendLocationReceiver,intentFilter);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_FRIEND_LOCATION_LIST:
                    handleGetFriendLocationList(msg);
                    break;
            }
        }
    };


    ActionBar actionBar = getSupportActionBar();
    actionBar.setLogo(R.mipmap.ic_arrow_back_white_24dp);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle("定位");


    initView();

    getFriendLocationList();
}
 
Example 16
Source File: AssistantService.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    mAppConfig = (AppConfig) getApplication();
    voiceMediator = VoiceMediator.create(this);
    voiceMediator.setChatStateListener(this);
    //创建数据库相关的表及dao
    DaoManager.create(this);
    mAudioPlayer = LingjuAudioPlayer.create(this);
    mAudioPlayer.setPlayStateListener(this);
    mAudioPlayer.setBluetoothChannelController(bluetoothController);
    chatRobotInited();
    // 初始化百度地图SDK组件
    SDKInitializer.initialize(getApplicationContext());
    BaiduLocateManager.createInstance(getApplicationContext());
    NavigatorService.createInstance(BaiduNaviDao.getInstance(), calculateRouteListener, this);
    //初始化喜马拉雅SDK
    XmlyManager.create(this);
    initProcessor();
    registerReveicer();
    isBlueToothHeadsetConnected();
    if (AppConfig.NewInstallFirstOpen)
        checkAudioRecordPermisssion();
    AppConfig.MainServiceStarted = true;
    //百度地图sdk超级奇葩的bug,在部分android4.+的手机测试发现,如果该方法在BaiduNaviManager.getInstance().init调用之后调用,则该方法无效
    SuggestionSearch.newInstance().requestSuggestion(new SuggestionSearchOption().city("广州市").keyword("天河城"));
    new Timer().schedule(new TimerTask() {
        @Override
        public void run() {
            Looper.prepare();
            EventBus.getDefault().post(new InitNaviManagerEvent());
        }
    }, 3000);
    setAlarm();
}
 
Example 17
Source File: LocationActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SDKInitializer.initialize(getApplicationContext());
    setContentView(R.layout.atom_ui_activity_location);
    bundle = getIntent().getExtras();
    bindViews();
    initView();
    ORIGIN_HEIGHT = Utils.dipToPixels(this, 256);
    MAX_HEIGHT = Utils.dipToPixels(this, 360);
    CLIP_WIDTH = (int) (Utils.getScreenWidth(this) * 0.8);
    CLIP_HEIGHT = CLIP_WIDTH * 9 / 16;
}
 
Example 18
Source File: MapSdkWrapper.java    From apollo-DuerOS with Apache License 2.0 4 votes vote down vote up
public static void init(Context context) {
    SDKInitializer.initialize(context);
    LocationUtil.getInstance().start(context);
}
 
Example 19
Source File: AppApplication.java    From VirtualLocation with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
	super.onCreate();
	// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
	SDKInitializer.initialize(this);
}
 
Example 20
Source File: HooweLocationProvider.java    From LocationProvider with Apache License 2.0 2 votes vote down vote up
/**
 * initialize Map SDK
 *
 * @param context
 */
public void initialize(Context context) {
    this.mContext = context;
    SDKInitializer.initialize(context);
}