How do I set an image in a notification in responsive mode?

In Android Native app, you can set the image in the notification easily. enter image description here

I need to create this functionality in my application. I am using https://github.com/evollu/react-native-fcm I think I should create a new activity for what overrides the notification constructor. but i'm confused where i can override the java class using Javascript. This tutorial will help me understand how to implement image notification in a native application.

Thank.

+3


source to share


1 answer


for the image you can use picture

in custom_notification

using the package react-native-fcm

. It should look like this:

      const payload = {
      data: {
          snapshot: JSON.stringify(original),
          custom_notification: JSON.stringify(
{
   id: 'topics/my-notif
   title: `title`,
   body: '',
   sound: 'default',
   priority: 'high',
   icon: 'ic_launcher',
   show_in_foreground: true,
   vibrate: 300,
   action: 'android.intent.action.MAIN',
   picture: 'https://asfsgsgafasfaf',
}
          )
      }
      //,notification:{title: `Car(${original.name}) registrated`,body: 'Waiting administration approve. ' + original.description}
  };

      



But this is one small problem if you are using Firebase storage. The package overrides the firebase reference. From %2F

to /

. SO its a bug, I opened the problem here: https://github.com/evollu/react-native-fcm/issues/931

and it might need to be merged. So when you put your image from firebase storage it can't get it and shows blank image ...

0


source







All Articles