We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how can I have custom notification builder in xamarin when using this plugin
The text was updated successfully, but these errors were encountered:
Create a custom PushNotificationHandler like this:
public class PushNotificationHandler: DefaultPushNotificationHandler { public override void OnBuildNotification(NotificationCompat.Builder notificationBuilder, IDictionary<string, object> parameters) { base.OnBuildNotification(notificationBuilder, parameters); try { if (!parameters.TryGetValue("image", out object imageUrlObject)) return; string imageUrl = imageUrlObject.ToString(); if (string.IsNullOrEmpty(imageUrl)) return; using (HttpClient httpClient = new HttpClient()) { byte[] imageBytes = httpClient.GetByteArrayAsync(imageUrl).Result; Bitmap image = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length); notificationBuilder.SetLargeIcon(Bitmap.CreateBitmap(image)); } } catch (Exception) { } } }
Then where you initialize do:
FirebasePushNotificationManager.Initialize(this, new PushNotificationHandler(), false, true, true);
Just make sure the notification has no "notification" object while sending or the handler won't be called. It only works with data-payload.
Sorry, something went wrong.
No branches or pull requests
how can I have custom notification builder in xamarin when using this plugin
The text was updated successfully, but these errors were encountered: