Java Code Examples for cn.jpush.android.api.JPushInterface#stopPush()

The following examples show how to use cn.jpush.android.api.JPushInterface#stopPush() . 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: MainActivity.java    From HaiNaBaiChuan with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
	int i = v.getId();
	if (i == R.id.init) {
		init();

	} else if (i == R.id.setting) {
		Intent intent = new Intent(MainActivity.this, PushSetActivity.class);
		startActivity(intent);

	} else if (i == R.id.stopPush) {
		JPushInterface.stopPush(getApplicationContext());

	} else if (i == R.id.resumePush) {
		JPushInterface.resumePush(getApplicationContext());

	} else if (i == R.id.getRegistrationId) {
		String rid = JPushInterface.getRegistrationID(getApplicationContext());
		if (!TextUtils.isEmpty(rid)) {
			mRegId.setText("RegId:" + rid);
		} else {
			Toast.makeText(this, "Get registration fail, JPush init failed!", Toast.LENGTH_SHORT).show();
		}

	}
}
 
Example 2
Source File: PushManager.java    From smart-farmer-android with Apache License 2.0 6 votes vote down vote up
public static void unregister(Context context) {
    if (context == null)
        return;
    if (RomUtil.rom() == PhoneTarget.EMUI) {
        HWReceiver.clearPushListener();
        com.huawei.android.pushagent.api.PushManager.deregisterToken(context, getToken(context).getToken());
        return;

    }
    if (RomUtil.rom() == PhoneTarget.MIUI) {
        MiMessageReceiver.clearPushListener();
        MiPushClient.unregisterPush(context);
        return;
    }

    if (RomUtil.rom() == PhoneTarget.JPUSH) {
        JPushReceiver.clearPushListener();
        JPushInterface.stopPush(context);
        return;
    }
}
 
Example 3
Source File: JPushManager.java    From AndroidPush with Apache License 2.0 5 votes vote down vote up
@Override
public void pause(Context context) {
    if (!JPushInterface.isPushStopped(context)) {
        JPushInterface.stopPush(context);
        if (JPushReceiver.getPushInterface() != null) {
            JPushReceiver.getPushInterface().onPaused(context);
        }
    }
}
 
Example 4
Source File: PushManager.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
/**
 * 停止推送
 */
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);
            }
        }
    }

}
 
Example 5
Source File: PushActivity.java    From AndroidFrame with Apache License 2.0 4 votes vote down vote up
public void stopPush(View view) {
    JPushInterface.stopPush(LQBApp.getApp());
    Toast.makeText(this, "推送已关闭", Toast.LENGTH_SHORT).show();
}
 
Example 6
Source File: JPushManager.java    From AndroidPush with Apache License 2.0 4 votes vote down vote up
@Override
public void unregister(Context context) {
    JPushReceiver.clearPushInterface();
    JPushInterface.stopPush(context);
}
 
Example 7
Source File: RLPushHelper.java    From Roid-Library with Apache License 2.0 4 votes vote down vote up
/**
* 
*/
  public void stop() {
      JPushInterface.stopPush(mContext);
  }