So here is my code that sets a notification that the user is bieng called via the zoom service. However if the user does not click the notification and instead just hits the app icon directly the extras are not captured correctly. I am a little lost on how to extract the extras from this pending intent in on resume.
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this); //build the new notification mBuilder.setSmallIcon(R.drawable.ic_launcher); mBuilder.setContentTitle(getString(R.string.incoming_zoom_meeting_title)); mBuilder.setContentText(String.format(getString(R.string.incoming_zoom_meeting_message), pushObject.getZoomCall().get(CIConstants.ZOOM_TITLE))); mBuilder.setSound(Uri.parse("android.resource://" + this.getPackageName() + "/" + R.raw.constellation)); //This sets the sound to play
Intent resultIntent = new Intent(this, MainActivity.class); //set notification click behavior
resultIntent.putExtra(CIConstants.ZOOM_MEETING_ID, pushObject.getZoomCall().getString(CIConstants.ZOOM_MEETING_ID).trim());
resultIntent.putExtra(CIConstants.ZOOM_USER_ID,pushObject.getZoomCall().get(CIConstants.ZOOM_TITLE).toString());
PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
int mNotificationId = 001;
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId, mBuilder.build());
This is then retrived in the main activity via.
if (savedInstanceState == null) {
Bundle extras = getIntent().getExtras();
mMeetingNumber = extras != null ? extras.get(CIConstants.ZOOM_MEETING_ID).toString() : null;
mMeetingCallerName = extras != null ? extras.get(CIConstants.ZOOM_USER_ID).toString() : null;
//if there is a meeting id in the intent
mZoomCallIncoming = mMeetingNumber != null && !mMeetingNumber.isEmpty();
}
Any help is really appreciated =D.