本文整理汇总了Java中com.baidu.android.pushservice.PushManager.isPushEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java PushManager.isPushEnabled方法的具体用法?Java PushManager.isPushEnabled怎么用?Java PushManager.isPushEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baidu.android.pushservice.PushManager
的用法示例。
在下文中一共展示了PushManager.isPushEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import com.baidu.android.pushservice.PushManager; //导入方法依赖的package包/类
@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);
}
}
}
}
示例2: initData
import com.baidu.android.pushservice.PushManager; //导入方法依赖的package包/类
/**
* 初始化数据
*/
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);
}
}
示例3: onResume
import com.baidu.android.pushservice.PushManager; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
IntentFilter filter = new IntentFilter(UnreadMsgReceiver.ACTION);
filter.setPriority(1);
newMsgBroadcastReceiver = new NewMsgBroadcastReceiver();
registerReceiver(newMsgBroadcastReceiver, filter);
newMsgScheduledExecutorService = Executors
.newSingleThreadScheduledExecutor();
newMsgScheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
getUnreadCount();
}
}, 10, 50, TimeUnit.SECONDS);
if (!PushManager.isPushEnabled(this))
PushManager.resumeWork(this);
mHomeWatcher = new HomeWatcher(this);
mHomeWatcher.setOnHomePressedListener(this);
mHomeWatcher.startWatch();
if (!Utility.isConnected(this))
mNetErrorView.setVisibility(View.VISIBLE);
else {
mNetErrorView.setVisibility(View.GONE);
}
PushMessageReceiver.ehList.add(this);
initRecentData();
global.getNotificationManager().cancel(
PushMessageReceiver.NOTIFY_ID);
PushMessageReceiver.mNewNum = 0;
/*
* getContentResolver().registerContentObserver(
* RosterProvider.CONTENT_URI, true, mRosterObserver);
* setStatusImage(isConnected()); if (!isConnected())
* mTitleNameView.setText(R.string.login_prompt_no);
* mRosterAdapter.requery(); XXBroadcastReceiver.mListeners.add(this);
* if (NetUtil.getNetworkState(this) == NetUtil.NETWORN_NONE)
* mNetErrorView.setVisibility(View.VISIBLE); else
* mNetErrorView.setVisibility(View.GONE); ChangeLog cl = new
* ChangeLog(this); if (cl != null && cl.firstRun()) {
* cl.getFullLogDialog().show(); }
*/
}