Set onClickListener on GCM Notofication

ساخت وبلاگ

Vote count: 0

I use GCM and when notifications comes I want to make some special things. So, I need something like onClickListener on the Notification. Any idea ? Here is my code:

 Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.lastlast) .setContentTitle(getString(R.string.message)) .setContentText(resMessage+getString(R.string.interested_int_you)) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
asked 2 mins ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 189 تاريخ : چهارشنبه 11 فروردين 1395 ساعت: 3:30