2 回答
TA贡献1851条经验 获得超3个赞
在调用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贡献1876条经验 获得超7个赞
也许您正在创建的待处理意图比应用程序中的要多。在这种情况下,您应该使用,
PendingIntent.FLAG_CANCEL_CURRENT
从头开始创建 Intent 并扩充您的包
添加回答
举报