void CreateNotification(string title, string message, int notifyId, string tag, Bundle extras) { System.Diagnostics.Debug.WriteLine($"{PushNotificationKey.DomainName} - PushNotification - Message {title} : {message}"); NotificationCompat.Builder builder = null; Context context = Android.App.Application.Context; if (CrossPushNotification.SoundUri == null) { CrossPushNotification.SoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification); } try { if (CrossPushNotification.IconResource == 0) { CrossPushNotification.IconResource = context.ApplicationInfo.Icon; } else { string name = context.Resources.GetResourceName(CrossPushNotification.IconResource); if (name == null) { CrossPushNotification.IconResource = context.ApplicationInfo.Icon; } } } catch (Android.Content.Res.Resources.NotFoundException ex) { CrossPushNotification.IconResource = context.ApplicationInfo.Icon; System.Diagnostics.Debug.WriteLine(ex.ToString()); } Intent resultIntent = context.PackageManager.GetLaunchIntentForPackage(context.PackageName); //Intent resultIntent = new Intent(context, typeof(T)); if (extras != null) { resultIntent.PutExtras(extras); } // Create a PendingIntent; we're only using one PendingIntent (ID = 0): const int pendingIntentId = 0; var currentMillis = (long)DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; PendingIntent resultPendingIntent = PendingIntent.GetActivity(context, pendingIntentId, resultIntent, PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent); resultPendingIntent.SetAction($"{currentMillis}"); // Build the notification builder = new NotificationCompat.Builder(context) .SetAutoCancel(true) // dismiss the notification from the notification area when the user clicks on it .SetContentIntent(resultPendingIntent) // start up this activity when the user clicks the intent. .SetContentTitle(title) // Set the title .SetSound(CrossPushNotification.SoundUri) .SetSmallIcon(CrossPushNotification.IconResource) // This is the icon to display .SetContentText(message); // the message to display. if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBean) { // Using BigText notification style to support long message var style = new NotificationCompat.BigTextStyle(); style.BigText(message); builder.SetStyle(style); } NotificationManager notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService); notificationManager.Notify(tag, notifyId, builder.Build()); }