I am building an app contains chat but i couldn't figure out somethings.
Notifications: I can send notifications to devices but they appear everytime (app in on screen or not) but i want to send "chat" notification only the chat page not open. I think i need to send data notifications instead of normal notifications.
Storing chats: I can't pull all the chats eveytime user wants to see messages. I need to store them and show only the new messages. How can i seperate them? Device has to say i have messages until this timestamp give me newer ones.
I am using firebase and gifted chat. I can give you any version codes if you want.
Related
In this simple scenario, why would someone choose to pay for a realtime service like Firestore for delivering latest updates, when a system based on Push Notifications can work as good?
If the user is not in the app, you can refresh the page as soon as the user taps the notification or opens the app. When the app is open you can refresh when a data notification is received.
What am I missing?
Why should anyone use something like Firestore when Push Notifications seems to be enough?
I am building my app using Ionic3 and Firebase. Here users can send eatch other messages. I want when a use sends a message to another ures he/she should get a notification in the phone even when the app is closed. I have no idea how to achieve this with Ionic3.
Any suggesions please.
I can see there are mainly 2 plugins for push notifications. cordova-plugin-firebase and cordova-plugin-fcm
At least I can fine some tutorial for cordova-plugin-fcm in the internet. There is no clear example of any wayout given for cordova-plugin-firebase.
You have to use the cordova-plugin-firebase and each time a user logs in using a device, a unique device ID will be registered with respect to that device. This device ID is used to send notifications. Make sure to handle this (device ID), every time a user logs in & logs out. If you do not remove the device_id from the database when a user logs out, he will continue to receive notifications.
You have to use a cordova-plugin for sending push notifications. One of the many available plugins is: cordova-plugin-firebase. This one is a good fit for Ionic 3 because there is an ionic-native wrapper available.
For sending the push notification you can use a third party service (there is also one offered by ionic) or you can send them yourself from your backend.
I'm developing an app using Firebase, in the app there are groups and for groups there are multiple members. I want to send notifications to members in a particular group based on one of the users activity. As an example in a chat app, notification to others informing there is a new message.
I referred this blog post. As it seems best way to do this is Firebase Topic Messaging, all members can be subscribed to the group id as a topic.
My matter is how to avoid receiving notification to the member who's action causes to the notification.
I tried Firebase message sending to multiple topics but it only allows for two logical operations (&&, ||)
Firebase Cloud Messaging has two types of messages: notification messages and data messages.
The default behavior of Firebase is that notification messages will automatically be displayed if the app is in the background or not running. This behavior cannot be modified. If the app is in the foreground, the notification message will not be automatically shown, it will instead be delivered to your app's code.
Data messages on the other hand will always be delivered to your app's code.
Since the user sending the message will typically have the app open, the default behavior will automatically ensure the notification is not shown on the sending user's device.
But in the blog post you refer to there is a race condition for this. If the user closes the app between the time they send the notification to the server and the time the server sends out the notification, the notification may show on their device too.
If this is a concern for your app, you should not use a notification message. Use a data message instead and include enough information in the message to detect which user has sent it (e.g. the user's uid).
I am writing back end for mobile app, we are sending pushes (something like one user add
another to buddies) he should accept it or decline via push notification(it is required), server got some feedback from notification, and do something.
I am familiar with two techniques about pushes, first I push directly on device using token, second is abstraction when user subscribes for channel and I send push notification on this channel. Id in my application is email, and I suggest to update device token in the database each time user login, and send push on it, but how should I identify device OS ?(IOS/Android)
1) How to scale it, if user have multiple devices, and when user will logout, and login from other device ?
May be there is common solutions for this problem.
I want to collect device attributes and send them to the mdm server using push notification.
Steps involved are:
create a configuration profile with mdm payload
get device token
use apple push notification service to send a notification to the device.
get back device attributes
do same with multiple devices which the company manages
Questions:
Will the user always need to act on a message or I can send a message onto the device without user action and get the work done?
Do I need an app on the device to send back the token?
It sounds like you're trying to use push notifications to poll iOS devices and return information.
Push notifications do not provide a mechanism to execute code on a device without user interaction. You would have to have an application loaded on the device, and the user would have to click through from the notification to your app.
In iOS, applications generally don't run unless the user is actively interacting with them. There are a few exceptions (e.g. background audio.)
You do need to have an app running to get the device token. You call registerForRemoteNotificationTypes. See APNs docs for more information.
Edited to add more information:
Looks like the MDM protocol uses push notifications to do just what you describe. However, there's nothing about it in Apple's "Local and Push Notification Programming Guide" (linked above).
Apparently Apple keeps tight control over the MDM documentation (see here and here).
However, I did find this paper from blackhat describing how the system works.
My earlier point about not executing arbitrary code on a device without user interaction still applies. There's a finite set of commands that can be executed (see Appendix A).
I came across this question when searching for iOS push notification access payload without user interaction - Just want to add that, in iOS 7 and above, it is possible to send silent push notifications to app, and app can process them without user interaction.
However, I've also found some discussions saying that the silent push notifications are not delivered reliably, in this SO post. That's why I'm still looking for alternate ways to retrieve payloads of the normal remote push notifications. Doesn't look like there's a way.