Reputation: 985
I am implementing calling functionality in my application with Twilio SDK. I am showing notification as soon as call starts, so the user can hang up the call from the notification bar. The problem is if user kills my application forcefully, I am not able to open the same calling activity from notification tray as my application is killed.
1: How can I detect if my app gets killed.
2: How Google play music notification works ( on click of notification it open the song detail activity - even though the application is killed).
3: How can I retain the same objects initialized at the time of creating the activity to disconnect the call.
Upvotes: 0
Views: 1498
Reputation: 1817
Try this
Intent intent = new Intent(context, NotificationActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID)
.setContentTitle("title")
.setContentText("Test notification")
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(contentIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH);
hope this help
Upvotes: 1