I'm making a notification when a user receive a video call in my app.
My notification :
Intent intent1 = new Intent(Intent.ACTION_CAMERA_BUTTON);
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
PendingIntent pendingIntent = PendingIntent.getActivity(context,0,intent1,0);
NotificationCompat.Action action = new NotificationCompat.Action(R.drawable.ic_camera_notification,"Ok",pendingIntent);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setContentTitle("TITRE !!")
.setContentText("Test")
.setPriority(Notification.PRIORITY_HIGH)
.setCategory(Notification.CATEGORY_CALL)
.setSmallIcon(R.drawable.ic_camera_notification)
.addAction(action)
.setSound(uri)
.setAutoCancel(true)
.setVibrate(new long[] { 1000, 1000});
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
Notification notification = builder.build();
notificationManager.notify(11,notification);
To repeat the notification until user answer (or limited time) I think to add a timer (like explain here : What is the equivalent to a JavaScript setInterval/setTimeout in Android/Java?)
But when user make a choice, I want to stop the timer. But there are no onClickListener, only Intent.
How can I do that ? Thanks