com.baidu.android.pushservice.PushConstants Java Examples

The following examples show how to use com.baidu.android.pushservice.PushConstants. 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: MyBroadcastReceiver.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
	if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
		//开机启动激活服务
		openAlarm(context);
		delayRequestCheckBgdServiceStatus(context);
	}else if (intent.getAction().equals(ACTION_BGD_SERVICE)){
           Intent myIntent = new Intent(context, BgdService.class);
           context.startService(myIntent);
	}else if (intent.getAction().equals(CONNECTIVITY_ACTION)){
		if (HttpUtil.isNetworkConnected(context)){
			//绑定百度云推送
			if(!PushManager.isPushEnabled(context)){
				PushManager.startWork(context,
						PushConstants.LOGIN_TYPE_API_KEY,
						MyApp.API_KEY);
			}
		}
	}
}
 
Example #2
Source File: ChatRoomFragment.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
/**
    * 初始化数据
    */
   private void initData() {
   	trainId = cContent.getTrainNum();
   	chatRoomTag = cContent.getPushTag();
	messageDB = MyApp.getInstance().getMessageDB();
	userInfoSPUtil = MyApp.getInstance().getUserInfoSPUtil();
	//初始化表情文字
	mFacemap = TT.getFaceMap();
	faceKeysList.addAll(mFacemap.keySet());
	messageAdapter = new MessageAdapter(getActivity(), messageDB.getMessage(trainId,MsgPagerNum), mFacemap);
	//检查push服务是否开启
	if(!PushManager.isPushEnabled(getActivity())){
		PushManager.startWork(getActivity(),
				PushConstants.LOGIN_TYPE_API_KEY,
				MyApp.API_KEY);
	}
	
	
}
 
Example #3
Source File: GosPushManager.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
public void bDPush() {
	final String BDPushAppKey = GosDeploy.setBaiDuPushAppKey();
	if (TextUtils.isEmpty(BDPushAppKey) || BDPushAppKey.contains("your_bpush_api_key")) {
		GosBaseActivity.noIDAlert(context, R.string.BDPushAppID_Toast);
	} else {

		PushManager.startWork(context, PushConstants.LOGIN_TYPE_API_KEY, BDPushAppKey);
		PushSettings.enableDebugMode(context, true);

	}

}
 
Example #4
Source File: GosPushManager.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
public void bDPush() {
	String BDPushAppKey = GosDeploy.setBaiDuPushAppKey();
	if (TextUtils.isEmpty(BDPushAppKey) || BDPushAppKey.contains("your_bpush_api_key")) {
		Toast.makeText(context, R.string.BDPushAppID_Toast, 2000).show();
	} else {
		PushManager.startWork(context, PushConstants.LOGIN_TYPE_API_KEY, BDPushAppKey);
	}

}
 
Example #5
Source File: GosPushManager.java    From gokit-android with MIT License 5 votes vote down vote up
public void bDPush() {
	final String BDPushAppKey = GosDeploy.setBaiDuPushAppKey();
	if (TextUtils.isEmpty(BDPushAppKey) || BDPushAppKey.contains("your_bpush_api_key")) {
		GosBaseActivity.noIDAlert(context, R.string.BDPushAppID_Toast);
	} else {

		PushManager.startWork(context, PushConstants.LOGIN_TYPE_API_KEY, BDPushAppKey);
		PushSettings.enableDebugMode(context, true);

	}

}
 
Example #6
Source File: CompatibilityDemoInit.java    From ans-android-sdk with GNU General Public License v3.0 4 votes vote down vote up
private static void initBaiDuPush() {
    com.baidu.android.pushservice.PushManager.startWork(mContext,
            PushConstants.LOGIN_TYPE_API_KEY, BAIDU_APP_KEY);
}
 
Example #7
Source File: WelcomeAty.java    From Huochexing12306 with Apache License 2.0 4 votes vote down vote up
@SuppressLint("WorldReadableFiles")
	@Override
	public void run() {
		//确定已复制数据库
		MyDatabase myDB = new MyDatabase(this);
		myDB.closeDB();
		
//		setSP.setTravelFirstShow(true);
		try {
			if (HttpUtil.isNetworkConnected(this)) {
				// 绑定百度云推送
				PushManager
						.startWork(this.getApplicationContext(),
								PushConstants.LOGIN_TYPE_API_KEY,
								MyApp.API_KEY);
			}
			//移动历史离线文件到SD卡
			updateHisOfflineFile();
			
			//初始化抢票监控状态
			String strMFilesPath = MyApp.getInstance().getPathBaseRoot(StoreValue.MONITOR_INFOS_FILE);
			@SuppressWarnings("unchecked")
			List<MonitorInfo> lstMInfos = (List<MonitorInfo>) PersistentUtil.readObject(strMFilesPath);
			if (lstMInfos != null && lstMInfos.size() != 0){
				for (MonitorInfo mInfo : lstMInfos) {
					mInfo.setRunning(false);
					mInfo.setStatus(BgdService2.STATUS_STOPED);
				}
				PersistentUtil.writeObject(lstMInfos, strMFilesPath);
			}
			
			Thread.sleep(1000);
			//检查是否是第一次登录
			if (setSP.isFirstUse()){
				startActivity(new Intent(WelcomeAty.this,
						LoginAty.class));
			}else{
				launtchDefaultAty();
			}
			finish();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}