Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APN, GCM(FCM): How to add rich media to notifications?

I am working on a productivity mobile app with target android, iOS. I am using the meteor framework, cordova, and my app sends notifications using raix:push. Now I want to take advantage of the new features offered by Apple's UserNotifications Framework introduced with iOS10. More specifically, I want to allow custom actions, send document previews as media attachments, and perhaps set a custom UI to have a rectangular viewport which is more suitable to documents.

I did some research and I am a little worried that the lib referenced above will be deprecated, rather soon if meteor will indeed migrate to graphql. Perhaps this would be the time to integrate some hosted realtime data stream network service like Pusher? It feels a bit weird, as this 'three way binding' is exactly the thing meteor excels in.

What is your suggestion/experience, how do you implement rich mobile notifications?

like image 851
JC- Avatar asked Sep 30 '16 10:09

JC-


People also ask

How do I add a photo to a notification on android?

To add an image in your notification, pass an instance of NotificationCompat. BigPictureStyle to setStyle() .

How do I handle background notifications on Android?

Handle notification messages in a backgrounded app A user tap on the notification opens the app launcher by default. This includes messages that contain both notification and data payload (and all messages sent from the Notifications console).

How do I get data notifications on Android?

Open new activity on click of push notification. Display data coming from push notification of new activity. If the application is closed so after click on notification the app get started.


1 Answers

You can use rich notifications in android with pre-defined templates

If you want a custom notification style other than available styles

NotificationCompat.BigPictureStyle, 
NotificationCompat.BigTextStyle, 
NotificationCompat.InboxStyle, 
NotificationCompat.MediaStyle, 
NotificationCompat.MessagingStyle

You can design your own notification layout in android as described in Change Notification Layout.

FCM cross-platform (iOS, Android) messaging solution is recommended for limited size data transfer:

Message Type        
Notifications up to 2kb     
Data messages up to 4kb 

So send data payload only for notification display and for downloading content (like media url) when you handle the message if you choose FCM.

There is also Facebook In-App notifications which you may want to explore

In-app notifications use rich media—such as photos, animated GIFs, emoji and more—to help you create engaging experiences that people receive directly in your app.

like image 163
random Avatar answered Sep 20 '22 18:09

random