hey guys, i have a ionic chat application who works we’ll. but i want to send push notification whene a user receive new message.
message.subscribe((msgData)=> {
console.log("from message data : => " + msgData.record);
// Handle Message data here
//if (msgData.record.conversation_id.id === this.id) {
this.conversation.push(msgData.record); // content is my variable who receve's data
});
Push notifications are sent from the server to the Ionic app.
If this code is in your Ionic app, it is only executed when the user is already in the app and he doesn’t need a push notification.
That depends on your backend application. I guess you have something like “send message from A to B”, then you write the message to the database, and at that moment you can also send a push notification to the user B. If they are already in the app you can handle that whatever way you want, but if not they will see this notification.
No as if the user is not running the app, you can’t trigger a local notification.
Push notifications were made exactly for this and how Whatsapp, Facebook Messenger and all the other chat apps do it.
Did you find any solution on how to make it work?
i face same problem in my real time chat app
i need when some one send message to other send to that user notification that some one message you
like whats app and other apps