سلام یه راهش اینه که یه سرویس بنویسید و کد هایی که میخواید بعد از کلیک اجرا بشه رو داخلش بگونجونید .
فقط به جای pendingIntent.getActivity بنویسید : pendingIntent.getService
خلاصه یه همچین چیزی :
فقط به جای pendingIntent.getActivity بنویسید : pendingIntent.getService
خلاصه یه همچین چیزی :
کد پیاچپی:
Intent notificationIntent = new Intent(mContext, HandleNotificationClickService.class);
PendingIntent pendingIntent = PendingIntent.getService(mContext, 0, notificationIntent, 0);
Notification notification = new Notification(icon, tickerText,System.currentTimeMillis());
notification.setLatestEventInfo(mContext,contentTitle , contentText, pendingIntent);
notification.flags = Notification.FLAG_AUTO_CANCEL | Notification.FLAG_ONGOING_EVENT;
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(CALLER_ID_NOTIFICATION_ID, notification);