2 回答

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超3個(gè)贊
在調(diào)用sendNotification()else 條件之前,您將 bundle 置于不同的intent,而不是notifyIntent。在 else 中更改您的代碼,如下所示
else {
// TODO: 10-10-2018 tapping on notification does nothing!!
Log.d(TAG, "onHandleIntent(): Sending success notification.");
String body = "Parsing complete for the url: " + url;
Intent notifyIntent = new Intent(getApplicationContext(), ListSongsActivity.class);
notifyIntent.putExtra(Constants.MUSIC_SITE, siteName);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Bundle bundle = new Bundle();
bundle.putParcelable(Constants.PARSED_ARTIST_INFO, artistInfo);
notifyIntent.putExtras(bundle);
CommonUtils.sendNotification(getApplicationContext(), Constants.LIST_SONGS_NOTIFICATION_TITLE
, body, Constants.LIST_SONGS_NOTIFICATION_CHANNEL_ID, notifyIntent,
Constants.LIST_SONGS_NOTIFICATION_ID, R.drawable.ic_launcher_background);
}

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超7個(gè)贊
也許您正在創(chuàng)建的待處理意圖比應(yīng)用程序中的要多。在這種情況下,您應(yīng)該使用,
PendingIntent.FLAG_CANCEL_CURRENT
從頭開始創(chuàng)建 Intent 并擴(kuò)充您的包
添加回答
舉報(bào)