本文整理汇总了Java中cn.jpush.android.api.JPushInterface.clearNotificationById方法的典型用法代码示例。如果您正苦于以下问题:Java JPushInterface.clearNotificationById方法的具体用法?Java JPushInterface.clearNotificationById怎么用?Java JPushInterface.clearNotificationById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.jpush.android.api.JPushInterface
的用法示例。
在下文中一共展示了JPushInterface.clearNotificationById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jumpToDetail
import cn.jpush.android.api.JPushInterface; //导入方法依赖的package包/类
/**
* 跳转页面 - 点击通知后
*
* @param bundle 通知内容
*/
private void jumpToDetail(Context context, Bundle bundle) {
//清除指定通知
JPushInterface.clearNotificationById(context, bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID));
try {
JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
String id = json.getString("id");
String classid = json.getString("classid");
String type = json.getString("type");
LogUtils.d(TAG, "id = " + id + " classid = " + classid + " type = " + type);
if (type.equals("photo")) {
PhotoDetailActivity.start(context, classid, id);
} else {
NewsDetailActivity.start(context, classid, id);
}
} catch (JSONException e) {
LogUtils.d(TAG, "解析推送数据失败");
}
}
示例2: startP2P
import cn.jpush.android.api.JPushInterface; //导入方法依赖的package包/类
/**
* 跳转至P2P界面
*
* @param context
* @param bundle
* @throws JSONException
*/
private void startP2P(Context context, Bundle bundle) throws JSONException {
String alert = bundle.getString(JPushInterface.EXTRA_ALERT);
String extra = bundle.getString(JPushInterface.EXTRA_EXTRA);
String notification = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
Logger.d(TAG, "[MyReceiver] notification - " + notification + ", extras: " + extra);
JSONObject jsonObject = new JSONObject(extra);
Bundle bundle1 = new Bundle();
bundle1.putString("userid", SharePrefUtil.getString("userid"));
bundle1.putString("callid", jsonObject.getString("p2p_userid"));
bundle1.putInt("p2p_mode", jsonObject.getInt("p2p_type"));
bundle1.putBoolean("p2p_push", true);
Intent i = new Intent(context, P2PCallActivity.class);
i.putExtras(bundle1);
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(i);
JPushInterface.clearNotificationById(context,bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID));
}
示例3: clearNotificationById
import cn.jpush.android.api.JPushInterface; //导入方法依赖的package包/类
public static void clearNotificationById(JSONArray data, CallbackContext callbackContext) {
int notificationId = -1;
try {
notificationId = data.getInt(0);
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("error reading id json");
return;
}
if (notificationId != -1) {
JPushInterface.clearNotificationById(NXTPushPlugin.getActivity(), notificationId);
} else {
callbackContext.error("error id");
}
}