cordova-plugin-firebase
cordova-plugin-firebase copied to clipboard
showing large image in firebase notification
I am doing one Cordova application where I want to show large image in notification when we expand it ( When app is background ). Even I tired like this also from console.
{ "data": { "image": "https://static.pexels.com/photos/4825/red-love-romantic-flowers.jpg", "message": "Firebase Push Message Using API" "AnotherActivity": "True" }, "to" : "device id Or Device token" }
In data i can see image link but its not showing in notification. Even i tired in some other ways but no use.
Thanks in Advance
This plugin currently doesn't support that. The sample payload you provided looks like it was taken from this article which specifically had code to handle the image in the notification.
Hey @swbradshaw @robertarnesson Showing big images on Android is a major feature I think. The code is quite easy:
NotificationCompat.BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
bigPicture.bigPicture(getBitmapFromURL(extras.getString("picture")));
do you plan to add this feature in future or do you want a PR?
@alexislg2 I'll take a PR
here is the PR https://github.com/arnesson/cordova-plugin-firebase/pull/296
@alexislg2 Do you need help with this? Or is it just waiting for merge? I have data coming into the app just fine, but would also like the image to display like I had when I wrote my app in Native android.
I guess I should add that I tried ionic cordova plugin add https://github.com/alexislg2/PushPlugin.git with no luck, wish I could use this change to test with.
@alexislg2 I just manually replaced the files from your PR 296 and I am not seeing an image still. Here is a sample of my data load.
const payload = {
data: {
title: 'You have a new follower!',
data_title:'You have a new follower!',
text: `${follower.displayName} is now following you.`,
image: follower.photoURL,
'image-type':'circle',
id: followerUid
}
};
I am testing on Apache Cordova native platform version 6.2.3 Nexus 6P Android 7.1.2
try removing the title
field
On Tue, Jul 4, 2017 at 4:47 PM, Alex Patterson [email protected] wrote:
@alexislg2 https://github.com/alexislg2 I just manually replaced the files from your PR 296 and I am not seeing an image still. Here is a sample of my data load.
const payload = { data: { title: 'You have a new follower!', data_title:'You have a new follower!', text:
${follower.displayName} is now following you.
, image: follower.photoURL, 'image-type':'circle', id: followerUid } };I am testing on Apache Cordova native platform version 6.2.3 Nexus 6P Android 7.1.2
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arnesson/cordova-plugin-firebase/issues/250#issuecomment-312896159, or mute the thread https://github.com/notifications/unsubscribe-auth/AHkMmEUQ9TWP2vKfVX9NO6j50qPibfzoks5sKlBugaJpZM4ND4zv .
@alexislg2 it won't trigger at all then. I also tried changing the code over to this and it never falls into the if statement.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
title = remoteMessage.getData().get("data_title");
text = remoteMessage.getData().get("text");
id = remoteMessage.getData().get("id");
} else {
title = remoteMessage.getNotification().getTitle();
text = remoteMessage.getNotification().getBody();
id = remoteMessage.getMessageId();
}
Have you tried with the code sample I added in the readme?
Le 4 juil. 2017 5:17 PM, "Alex Patterson" [email protected] a écrit :
@alexislg2 https://github.com/alexislg2 it won't trigger at all then. I also tried changing the code over to this and it never falls into the if statement.
if (remoteMessage.getData().size() > 0) { Log.d(TAG, "Message data payload: " + remoteMessage.getData()); title = remoteMessage.getData().get("data_title"); text = remoteMessage.getData().get("text"); id = remoteMessage.getData().get("id"); } else { title = remoteMessage.getNotification().getTitle(); text = remoteMessage.getNotification().getBody(); id = remoteMessage.getMessageId(); }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arnesson/cordova-plugin-firebase/issues/250#issuecomment-312902605, or mute the thread https://github.com/notifications/unsubscribe-auth/AHkMmM3M7hZYBMI9xS1NtmKVMq-n5coXks5sKlefgaJpZM4ND4zv .
Has this PR already been merged with Master? I couldn't find BigPictureStyle in the code of master...
Hi Guys! Any news with it?
@Simbaclaws @kurtiev The PR is out of date and was closed. If we could get an updated PR, we can look at merging it in. I believe the PR mentioned an issue on iOS that was limiting the functionality but it has since been fixed. Please check out the Contribution Guidelines to how to create a submission.
This is for IONIC 3 notification with Image and Text from firebase Implement Phonegap Push Plugin and create your firebase project ionic cordova plugin add phonegap-plugin-push //Now we send the Notification Post service URL=https://fcm.googleapis.com/fcm/send Header: Authorization: key={Your Firebase Key} Content-Type: application/json then send Body Body: { "to": "/topics/college", "data": { "title": "Notification With Image", "message": "This is my Notification with Image", "style": "picture", "picture": https://appsolzone.com/wp-content/uploads/2018/07/Scholar-Wings-2-480x336.jpg", "summaryText": "This is image notification with Firebase in IONIC" } }