本文整理匯總了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");
}
}