本文整理匯總了Java中cn.jpush.android.api.JPushInterface.isPushStopped方法的典型用法代碼示例。如果您正苦於以下問題:Java JPushInterface.isPushStopped方法的具體用法?Java JPushInterface.isPushStopped怎麽用?Java JPushInterface.isPushStopped使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.jpush.android.api.JPushInterface
的用法示例。
在下文中一共展示了JPushInterface.isPushStopped方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initUI
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 因為會重新加載,
*/
@Override
protected void initUI() {
boolean isNight = SPUtil.getBoolean(Constants.IS_NIGHT_MODE);
setImageButtonState(mSettingDayNight, isNight);
boolean isPush = !JPushInterface.isPushStopped(getApplicationContext());
setImageButtonState(mSettingJpush, isPush);
String fontFamily = SPUtil.getString(Constants.FONT_FAMILY, WEI_RUAN_YA_HEI);
mFontChangeTv.setText(fontFamily.equals(WEI_RUAN_YA_HEI) ? "雅黑 --> 行書" : "行書 --> 雅黑");
}
示例2: switchJPushMode
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 更改推送的狀態
*/
private void switchJPushMode() {
// 獲得之前的狀態
boolean isStoped = JPushInterface.isPushStopped(getApplicationContext());
// 取反並設置
setImageButtonState(mSettingJpush, isStoped);
// 更改推送狀態
if (isStoped) {
JPushInterface.resumePush(getApplicationContext());
} else {
JPushInterface.stopPush(getApplicationContext());
}
}
示例3: onClick
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.resumePush:
JPushInterface.resumePush(v.getContext());
break;
case R.id.stopPush:
JPushInterface.stopPush(v.getContext());
break;
case R.id.isStopPush:
boolean isStop = JPushInterface.isPushStopped(v.getContext());
Toast.makeText(this, isStop ? "停止了推送" : "開始了推送", Toast.LENGTH_SHORT).show();
break;
}
}
示例4: pause
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 停止推送
*/
public static void pause(Context context) {
if (context == null)
return;
if (RomUtil.rom() == Target.EMUI) {
PushManager.enableReceiveNormalMsg(context, false);
PushManager.enableReceiveNotifyMsg(context, false);
if (EMHuaweiPushReceiver.getPushInterface() != null) {
EMHuaweiPushReceiver.getPushInterface().onPaused(context);
}
return;
}
if (RomUtil.rom() == Target.MIUI) {
MiPushClient.pausePush(context, null);
if (MiuiReceiver.getPushInterface() != null) {
MiuiReceiver.getPushInterface().onPaused(context);
}
return;
}
if (RomUtil.rom() == Target.FLYME) {
com.meizu.cloud.pushsdk.PushManager.unRegister(context, Const.getFlyme_app_id(), Const.getFlyme_app_key());
if (FlymeReceiver.getPushInterface() != null) {
FlymeReceiver.getPushInterface().onPaused(context);
}
return;
}
if (RomUtil.rom() == Target.JPUSH) {
if (!JPushInterface.isPushStopped(context)) {
JPushInterface.stopPush(context);
if (JPushReceiver.getPushInterface() != null) {
JPushReceiver.getPushInterface().onPaused(context);
}
}
return;
}
}
示例5: resume
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 開始推送
*/
public static void resume(Context context) {
if (context == null)
return;
if (RomUtil.rom() == Target.EMUI) {
PushManager.enableReceiveNormalMsg(context, true);
PushManager.enableReceiveNotifyMsg(context, true);
if (EMHuaweiPushReceiver.getPushInterface() != null) {
EMHuaweiPushReceiver.getPushInterface().onResume(context);
}
return;
}
if (RomUtil.rom() == Target.MIUI) {
MiPushClient.resumePush(context, null);
if (MiuiReceiver.getPushInterface() != null) {
MiuiReceiver.getPushInterface().onResume(context);
}
return;
}
if (RomUtil.rom() == Target.FLYME) {
com.meizu.cloud.pushsdk.PushManager.register(context, Const.getMiui_app_id(), Const.getFlyme_app_key());
if (FlymeReceiver.getPushInterface() != null) {
FlymeReceiver.getPushInterface().onResume(context);
}
return;
}
if (RomUtil.rom() == Target.JPUSH) {
if (JPushInterface.isPushStopped(context)) {
JPushInterface.resumePush(context);
if (JPushReceiver.getPushInterface() != null) {
JPushReceiver.getPushInterface().onResume(context);
}
}
return;
}
}
示例6: pause
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 停止推送
*/
public static void pause(Context context) {
if (context == null)
return;
if (RomUtil.rom() == PhoneTarget.EMUI) {
com.huawei.android.pushagent.api.PushManager.enableReceiveNormalMsg(context, false);
com.huawei.android.pushagent.api.PushManager.enableReceiveNotifyMsg(context, false);
if (HWReceiver.getPushListener() != null) {
HWReceiver.getPushListener().onPaused(context);
}
return;
}
if (RomUtil.rom() == PhoneTarget.MIUI) {
MiPushClient.pausePush(context, null);
if (MiMessageReceiver.getPushListener() != null) {
MiMessageReceiver.getPushListener().onPaused(context);
}
return;
}
if (RomUtil.rom() == PhoneTarget.JPUSH) {
if (!JPushInterface.isPushStopped(context)) {
JPushInterface.stopPush(context);
if (JPushReceiver.getPushListener() != null) {
JPushReceiver.getPushListener().onPaused(context);
}
}
}
}
示例7: resume
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 開始推送
*/
public static void resume(Context context) {
if (context == null)
return;
if (RomUtil.rom() == PhoneTarget.EMUI) {
com.huawei.android.pushagent.api.PushManager.enableReceiveNormalMsg(context, true);
com.huawei.android.pushagent.api.PushManager.enableReceiveNotifyMsg(context, true);
if (HWReceiver.getPushListener() != null) {
HWReceiver.getPushListener().onResume(context);
}
return;
}
if (RomUtil.rom() == PhoneTarget.MIUI) {
MiPushClient.resumePush(context, null);
if (MiMessageReceiver.getPushListener() != null) {
MiMessageReceiver.getPushListener().onResume(context);
}
return;
}
if (RomUtil.rom() == PhoneTarget.JPUSH) {
if (JPushInterface.isPushStopped(context)) {
JPushInterface.resumePush(context);
if (JPushReceiver.getPushListener() != null) {
JPushReceiver.getPushListener().onResume(context);
}
}
}
}
示例8: isPushStopped
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 極光是否停止了推送
*/
public static boolean isPushStopped(JSONArray data, CallbackContext callbackContext) {
boolean isStopped = JPushInterface.isPushStopped(cordovaCxt);
return isStopped;
}
示例9: saveToSP
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
private void saveToSP(User user) {
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_WQTOKEN, user.getT_user_login().getQqwx_token() != null ? user.getT_user_login().getQqwx_token() : "");
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_TEL, user.getT_user_login().getTel() != null ? user.getT_user_login().getTel() : "");
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_PASSWORD, user.getT_user_login().getPassword() != null ? user.getT_user_login().getPassword() : "");
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_USERID, user.getT_user_login().getId());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_STATUS, user.getT_user_login().getStatus());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_QNTOKEN, user.getT_user_login().getQiniu());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_APK_URL, user.getApk_url());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_VERSION, user.getVersion());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_CONTENT, user.getContent());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_RESUMM, user.getT_user_login().getResume());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_HOBBY, user.getT_user_login().getHobby());
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_NICK, user.getT_user_info().getNickname() != null ? user.getT_user_info().getNickname() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_NAME, user.getT_user_info().getName() != null ? user.getT_user_info().getName() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_IMG, user.getT_user_info().getName_image() != null ? user.getT_user_info().getName_image() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_SCHOOL, user.getT_user_info().getSchool() != null ? user.getT_user_info().getSchool() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_CREDIT, user.getT_user_info().getCredit());
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_INTEGRAL, user.getT_user_info().getIntegral());
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.USER_SEX, user.getT_user_info().getUser_sex());
// 暫時關閉果聊功能
// final ChatManager chatManager = ChatManager.getInstance();
if (!TextUtils.isEmpty(String.valueOf(user.getT_user_login().getId()))) {
if (JPushInterface.isPushStopped(getActivity().getApplicationContext())) {
JPushInterface.resumePush(getActivity().getApplicationContext());
}
//登陸leancloud服務器 給極光設置別名
// chatManager.setupManagerWithUserId(this, String.valueOf(user.getT_user_login().getId()));
JPushInterface.setAlias(getActivity().getApplicationContext(), "jianguo" + user.getT_user_login().getId(), new TagAliasCallback() {
@Override
public void gotResult(int i, String s, Set<String> set) {
LogUtils.e("jpush", s + ",code=" + i);
}
});
}
// ChatManager.getInstance().openClient(new AVIMClientCallback() {
// @Override
// public void done(AVIMClient avimClient, AVIMException e) {
// if (null == e) {
// TalkMessageEvent talkMessageEvent=new TalkMessageEvent();
// talkMessageEvent.isLogin=true;
// EventBus.getDefault().post(talkMessageEvent);
// } else {
// showShortToast(e.toString());
// }
// }
// });
}
示例10: saveToSP
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
private void saveToSP(User user) {
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_WQTOKEN, user.getT_user_login().getQqwx_token() != null ? user.getT_user_login().getQqwx_token() : "");
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_TEL, user.getT_user_login().getTel() != null ? user.getT_user_login().getTel() : "");
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_PASSWORD, user.getT_user_login().getPassword() != null ? user.getT_user_login().getPassword() : "");
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_USERID, user.getT_user_login().getId());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_STATUS, user.getT_user_login().getStatus());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_QNTOKEN, user.getT_user_login().getQiniu());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_APK_URL, user.getApk_url());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_VERSION, user.getVersion());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_CONTENT, user.getContent());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.LOGIN_HOBBY, user.getT_user_login().getHobby());
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_NICK, user.getT_user_info().getNickname() != null ? user.getT_user_info().getNickname() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_NAME, user.getT_user_info().getName() != null ? user.getT_user_info().getName() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_IMG, user.getT_user_info().getName_image() != null ? user.getT_user_info().getName_image() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_SCHOOL, user.getT_user_info().getSchool() != null ? user.getT_user_info().getSchool() : "");
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_CREDIT, user.getT_user_info().getCredit());
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.SP_INTEGRAL, user.getT_user_info().getIntegral());
SPUtils.setParam(getActivity(), Constants.LOGIN_INFO, Constants.SP_RESUMM, user.getT_user_login().getResume());
SPUtils.setParam(getActivity(), Constants.USER_INFO, Constants.USER_SEX, user.getT_user_info().getUser_sex());
// 暫時關閉果聊功能
// final ChatManager chatManager = ChatManager.getInstance();
if (!TextUtils.isEmpty(String.valueOf(user.getT_user_login().getId()))) {
if (JPushInterface.isPushStopped(getActivity().getApplicationContext())) {
JPushInterface.resumePush(getActivity().getApplicationContext());
}
//登陸leancloud服務器 給極光設置別名
// chatManager.setupManagerWithUserId(getActivity(), String.valueOf(user.getT_user_login().getId()));
JPushInterface.setAlias(getActivity().getApplicationContext(), "jianguo" + user.getT_user_login().getId(), new TagAliasCallback() {
@Override
public void gotResult(int i, String s, Set<String> set) {
LogUtils.e("jpush", s + ",code=" + i);
}
});
}
// ChatManager.getInstance().openClient(new AVIMClientCallback() {
// @Override
// public void done(AVIMClient avimClient, AVIMException e) {
// if (null == e) {
// TalkMessageEvent talkMessageEvent=new TalkMessageEvent();
// talkMessageEvent.isLogin=true;
// EventBus.getDefault().post(talkMessageEvent);
// } else {
//// Toast.makeText(getActivity(),e.getMessage(),Toast.LENGTH_SHORT).show();
//// getActivity().showShortToast(e.toString());
// }
// }
// });
}
示例11: saveToSP
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
private void saveToSP(User user) {
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_WQTOKEN, user.getT_user_login().getQqwx_token() != null ? user.getT_user_login().getQqwx_token() : "");
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_TEL, user.getT_user_login().getTel() != null ? user.getT_user_login().getTel() : "");
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_PASSWORD, user.getT_user_login().getPassword() != null ? user.getT_user_login().getPassword() : "");
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_USERID, user.getT_user_login().getId());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_STATUS, user.getT_user_login().getStatus());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_QNTOKEN, user.getT_user_login().getQiniu());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.SP_RESUMM, user.getT_user_login().getResume());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.LOGIN_APK_URL, user.getApk_url());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.LOGIN_VERSION, user.getVersion());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.LOGIN_CONTENT, user.getContent());
SPUtils.setParam(context, Constants.LOGIN_INFO, Constants.LOGIN_HOBBY, user.getT_user_login().getHobby());
SPUtils.setParam(context, Constants.USER_INFO, Constants.SP_NICK, user.getT_user_info().getNickname() != null ? user.getT_user_info().getNickname() : "");
SPUtils.setParam(context, Constants.USER_INFO, Constants.SP_NAME, user.getT_user_info().getName() != null ? user.getT_user_info().getName() : "");
SPUtils.setParam(context, Constants.USER_INFO, Constants.SP_IMG, user.getT_user_info().getName_image() != null ? user.getT_user_info().getName_image() : "");
SPUtils.setParam(context, Constants.USER_INFO, Constants.SP_SCHOOL, user.getT_user_info().getSchool() != null ? user.getT_user_info().getSchool() : "");
SPUtils.setParam(context, Constants.USER_INFO, Constants.SP_CREDIT, user.getT_user_info().getCredit());
SPUtils.setParam(context, Constants.USER_INFO, Constants.SP_INTEGRAL, user.getT_user_info().getIntegral());
SPUtils.setParam(context, Constants.USER_INFO, Constants.USER_SEX, user.getT_user_info().getUser_sex());
LogUtils.e("jpush","userid"+user.getT_user_login().getId());
//暫時關閉果聊功能
// final ChatManager chatManager = ChatManager.getInstance();
if (!TextUtils.isEmpty(String.valueOf(user.getT_user_login().getId()))) {
//登陸leancloud服務器 給極光設置別名
// LCChatKit.getInstance().open(String.valueOf(user.getT_user_login().getId()), new AVIMClientCallback() {
// @Override
// public void done(AVIMClient avimClient, AVIMException e) {
// if (null == e) {
// finish();
// Intent intent = new Intent(SplashActivity.this, MainActivity.class);
// startActivity(intent);
// } else {
// Toast.makeText(SplashActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
// }
// }
// });
// chatManager.setupManagerWithUserId(this, String.valueOf(user.getT_user_login().getId()));
LogUtils.e("jpush","調用jpush");
if (JPushInterface.isPushStopped(getApplicationContext())){
JPushInterface.resumePush(getApplicationContext());
}
// ","隔開的多個 轉換成 Set,設置tags
// String tag = "test";
// String[] sArray = tag.split(",");
// Set<String> tagSet = new LinkedHashSet<String>();
// tagSet.add(tag);
// for (String sTagItme : sArray) {
// tagSet.add(sTagItme);
// }
// JPushInterface.setAliasAndTags(getApplicationContext(),"jianguo"+user.getT_user_login().getId(),tagSet, new TagAliasCallback() {
// @Override
// public void gotResult(int i, String s, Set<String> set) {
// LogUtils.e("jpush",s+",code="+i);
// }
// });
JPushInterface.setAlias(getApplicationContext(),"jianguo"+user.getT_user_login().getId(), new TagAliasCallback() {
@Override
public void gotResult(int i, String s, Set<String> set) {
LogUtils.e("jpush",s+",code="+i);
}
});
}
}