I'm using SNS for push notifications for android and iOS. Since sending to both devices require different platform application, my endpoints are saved separately. How do I send push notification to all endpoints via SNS publish api in on request instead of many, please?
I've read that using Topics would give me that result, but from what I read, I need them (users) to accept (confirm) that they would like to get notifications..Isn't it going to complicate things, since users already accept notification when app first started?
Thanks.
For mobile applications you don't need a confirmation in order to subscribe an endpoint to a topic. See it in this SO question, so you can indeed use a topic to send a push notification to all endpoints. But beware of topic limits, they used to be 10000 endpoints per topic, but now it's 10000000 wich should be more than enough
Related
I am developing an Android app, which deals with allocating orders to multiple suppliers. Each supplier will have the same Android app installed. Every day, the in charge of the suppliers will open the app, pick up the suppliers to assign from the recyclerview and enter a customised message on the days' supply in an editText.
The message should be delivered in form of push notification to other suppliers he has selected from the recyclerview. So, in this case I cannot use Firebase console to send notifications. I initially thought of using Twilio to do this. But my client wanted to keep this as last option. They want me to try Push notifications.
I am researching, but every one is illustrating on how the notification can be sent through Firebase console. I also heard that GCM is obsolete now.
Please can anyone give me some pointers on how this can be done? Please note that I am a beginner in Android.
I think you can use firebase cloud messaging to achieve this. See FCM documentation.
You can send a push notification through firebase by using firebase HTTP protocol instead of the firebase console. In this way, you can programmatically send a push notification by making a REST call.
There are 2 firebase HTTP protocols that you may use to achieve this:
Legacy protocol:
This is the older firebase HTTP protocol. This is easier to set up and you can find a lot of material online explaining how to use this like medium article.
New protocol(HTTP V1):
This is the newer HTTP protocol. This is a little more difficult as authentication is done by oAuth token. However, this is more secure and extensible. Also, it seems like firebase might eventually deprecate the legacy API.
Hence, in your app, once the in charge of suppliers assigns the duties, you can call the firebase APIs to send out push notifications to all the assigned suppliers.
I am working on an app, which requires Android push notifications to be implemented.
I have decided to use Firebase Cloud Messaging directly; without using any other abstraction such as AWS SNS or Pusher.
I would like to avoid storing and managing device tokens in the backend, by using the following approach.
In the android app.
When the user logs into the android application, obtain device token but not send it to the server.
Subscribe to a topic that is based on a agreed convention, such that the topic is unique to that user.
On logout unsubscribe from the topic.
In the Server.
Whenever a situation arises to send a notification to particular user, send push notification to the topic, that is based on the convention.
I would like to know if this is a viable strategy to avoid managing device tokens ?
Case against using topics.
From the official docs.
Based on the publish/subscribe model, FCM topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. You compose topic messages as needed, and FCM handles routing and delivering the message reliably to the right devices.
For example, users of a local weather forecasting app could opt in to a "severe weather alerts" topic and receive notifications of storms threatening specified areas. Users of a sports app could subscribe to automatic updates in live game scores for their favorite teams.
I see that topics are recommended, when multiple devices are to be notified. But I have decided to create a topic per user, this would mean most topics would end up getting subscribed by only one device; Is this approach ok ?
I see that topics are recommended, when multiple devices are to be notified
Yes, multiple devices that have something common to listen to, which is the topic. Topics are used for messages that could be received by the general clients since it is public -- i.e. anyone could subscribe and receive messages sent to it.
What is advised to use for multiple devices, but for the same user is to use Device Groups (see my answer here for tips on Managing Device Groups). However, if you don't mind the "topics being public" part, then your approach should be fine.
Yes, Here required device tokens if we want to send push notification whoever installed your app.
My research we can save device tokens in back end at first time installation of your app that is better according to my understanding so that we can easy to send push notification across all devices.
I'm currently working on an application build on AWS. At first, the application was on Parse server and the push notifications were not a problem but then, when I migrated to AWS I encountered some issues with that.
As far as I read from this link http://aws.amazon.com/articles/9156883257507082 I learned that I need to create a topic to subscribe users by creating endpoints using the device tokens from where they are currently logged in.
I will have many users, and the notifications will be sent to all endpoints from a topic.
The problem is when I want to send a notification I want to exclude some users from a topic for receiving that, for example, when a user posts something I will not send a notification to him too. This is available also when I have a custom audience to send notifications to. I could create a topic for every event notification to be sent but I don't think this is a efficient method.
Is there a possibility to do that or Amazon does not even support this feature? Until now I didn't find anything on internet that can help me solve this problem and I hope I'll find here someone who worked with this.
Thank you for your time!
Plus : I also found a similar question here Send Push Notifications using Amazon SNS service but I still don't have a certain answer or some links about that.
From what I've found in AWS documentation, it states that
Send messages directly to a specific device by calling the Publish function with the device’s ARN. You can easily scale this to handle millions of users by storing the endpoint ARNs in Amazon DynamoDB and using multi-threaded code on the server.
Thus, to be able to filter users that receive notifications and not send bulk messages to all users subscribed to a topic, you need to send messages using the device's ARNs.
You can find more info here
I am new to gcm api for android and have for some time now i have being working on an android app to allow chatting between two users of the app. The app is such that a chat can only be initiated when one user opts to contact the other user. But my confusion comes in the manner i would be able to create a chatroom for these two users and for the other user to be able receive messages. since i found out that each user must subscribe to a topic inorder to receive messages in that topic. Would i have to subscribe all users to all possible topics or what? that is my big question but it seems it would have so much overhead considering i have 1000+ users.
Please i need all the help i can get here. Thanks
Would i have to subscribe all users to all possible topics or what?
GCM topic messaging allows your app server to send a message to multiple devices that have opted in to a particular topic.
It is not a requirement but it can ease the work for the server to send messages. In this tutorial, you will see that they have created a chat like environment using GCM without using the topic function.
BUT consider the effects on your server like how will it behave on the potential load when you use the topic messaging, especially the the message will trigger an interaction from the user to the server.
I want a push notification, when there is data in server change,delete or added etc The notification is associated with the user. And the Google Cloud Messaging notification is associated for the application running in device. Also there is a lot of over head for developers, when developer are creating the system using google cloud message. Therefore I decide not to use Google Cloud Message.
I know is using XMPP or WebSocket can fulfill my requirement but it is battery inefficient. My question is there a better approach to fulfill my requirement.
You can send the GCM registration Id in the login request to the server and remove it once the user logs out. This way you can send a GCM message to a particular user.
If you want to use a GCM alternative you can try Pushy.me, its also a very good service that uses MQTT protocol and have less headaches as compared to GCM.
Depending on your specific needs, using an alarm and intent service to poll your server every so often - say 24 hours - can work. Then create a local notification if needed. This way no third parties are needed, but you won't have real time notifications.