2016-10-18 5 views
1

알림을 취소하거나 스 와이프하면 활동이 시작됩니다. 이 문제를 해결하는 방법? 의도 resultIntent = 새로운 의도 (this, SmsThreadActivity.class);알림을 스 와이프/취소 할 때 Android 활동이 시작됩니다.

 resultIntent.putExtra("address", address); 
     resultIntent.putExtra("thread_id", threadId); 
     resultIntent.putExtra("msg_type", msgType); 

     Intent backIntent = new Intent(this, MainActivity.class); 
     backIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); 

     PendingIntent pendingIntent = PendingIntent.getActivities(this, 
       0, new Intent[] {backIntent, resultIntent}, PendingIntent.FLAG_UPDATE_CURRENT); 

     NotificationCompat.Builder builder = new NotificationCompat.Builder(this); 
     builder.setSmallIcon(R.mipmap.ic_app_icon_9); 
     builder.setContentIntent(pendingIntent); 
     builder.setDeleteIntent(pendingIntent); 
     builder.setContentTitle(contactName); 
     builder.setStyle(new NotificationCompat.BigTextStyle().bigText(body)); 
     builder.setContentText(body); 
     if (PreferencesUtil.Notification.getStatus(this, Constants.NotificationSettings.SOUND)) { 
      builder.setSound(uri); 
     } 
     builder.setVibrate(vibratePattern); 
     builder.setPriority(2); 
     builder.setAutoCancel(true); 

     NotificationManager manager = 
       (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); 

     manager.notify(id, builder.build()); 
+0

삭제 'builder.setDeleteIntent (pendingIntent);'사용자가 통지 삭제시 트리거하도록 요청하고 있습니다. – aiqency

답변

0
builder.setDeleteIntent(pendingIntent); 

이 줄은 알림이 기각 될 때 pendingIntent를 시작 말하고있다.