好的,我现在正在做的是通过FCM获得推送通知一直进展顺利.现在我可以在应用程序处于前台时更改活动,但是当我在通知面板中点击通知时如何更改它?需要帮忙.
我的代码:
public void showNotificationMessage(final String title, final String message, final String timeStamp, Intent intent, String imageUrl) {
// Check for empty push message
if (TextUtils.isEmpty(message))
return;
// notification icon
final int icon = R.mipmap.ic_launcher;
// on click activity for the notification !!!!!!!!!!
intent = new Intent(Intent.ACTION_MAIN);
intent.setClass(mContext, TestActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
final PendingIntent resultPendingIntent =
PendingIntent.getActivity(
mContext,
0,
intent,
PendingIntent.FLAG_CANCEL_CURRENT
);
final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
mContext);
Run Code Online (Sandbox Code Playgroud) android push-notification android-notifications firebase firebase-cloud-messaging