CloudKit/Firebase: is it possible to send not only push when a record changes but also mail? - ios

In my app I do need synchronization/communication between devices, therefore I need a serverside database. Whenever some special record changes, I need to send a push notification and/or an email.
It's an iOS-only app, so Cloudkit would be fine, but I don't think that it's possible to send an e-mail. Same fore Firebase. Am I overlooking something or are there very similar alternatives which are capable of both, sending push and mail?

Since March 2017 there's an integration between Google Cloud Functions and Firebase. This allows you to run JavaScript code on Google's servers in response to events that happen in Firebase. A node being written to the database is one such event, but there are many more use-cases.
Your use-case seems closest to this sample, which sends a welcome email when a user subscribes to some fictional newsletter.

Related

How to get notification when data change in firebase storage?

I am working in photo vault app. So i need to detect changes of firebase database from my app when someone insert new photo or delete photo.I can log in from different device using same user id. I need to reload my collection view in that time. I saw cloud message notification. But i need a notification for data entry. Please help me.
Firebase now have a new tool called Cloud Functions.
With this you can execute code without a server, listen to Firebase Database and send notifications.
Take a look to the documentation, it's easy:
https://firebase.google.com/docs/functions/use-cases
Jaime reply about the cloud function suites well if you are inclined to use google offerings. If not, here's how one would approach the problem... Any database is not exposed to client applications directly. Normally there's a web server that writes to the database. So from the web server when you write to database, you can integrate with a unified push notification provider (Amazon SNS, Bluemix Push, etc) to send a notification to the client application on mobile or web.

Mobile Chat application on Google App Engine and Socket.IO

I am creating a chat application with Node.JS's Socket.IO and there is a couple things I need clarification on.
I am implementing offline messaging in my app meaning that when a user opens the app he will receive all the messages he missed when they were online.
This is my approach:
1) Client opens the app and is subscribed/joins a room
2) The client sends a message to Socket.IO
3) Socket.IO inserts the message in some kind of database/datastore
4) When client tries to retrieve the messages it is pulled from the database/datastore and saved on the users phone then it is deleted from the database.
Is this a correct approach?
I was looking at online and some people suggested using task/message queues like Google App Engines Task Queue but I am not sure how this works.
Your approach sounds OK, but I wouldn't delete messages from a DB, at least not immediately after the client receives them.
From your question it seems that you're not currently saving the messages to a database.
This approach has some drawbacks; for example, the user can't view their chat history on a device that was not connected when some of the messages were sent.
There are 2 ways I can think of to do it in a more elegant manner:
Save all messages to DB. on websocket connection and reconnections, fetch all messages newer than your latest message (This approach assumes no edit functionality in your chat, as edits will not be fetched this way). The latter can be implemented using either HTTP or WebSockets.
If you don't want to store the messages in your server, then you should implement some sort of persistent cache in the device used to send the messages. This is very similar to your original solution, except that instead of storing the messages in a database, you're storing them on the user's device. this does require some logic to detect when messages are received, and when the recipient reconnects, in order to trigger sending the missing messages.
The first approach is much better for the general use case in my opinion, but it depends on your use case.

Best way to implement push notifications with Firebase

I am an iPhone app coder, and I'm using Firebase as my backend server. Firebase doesn't support Push Notifications, so I've been trying to figure out how to include them in my app. I've read this question: How to send an alert message to a special online user with firebase but it seems like more of a work-around than an actual solution.
Is there an answer on how to do this? Are there third parties or APIs that might seemlessly implement this functionality?
One solution I have tried is to use Zapier to connect Firebase to Pushover.
At this point, I've been able to observe events in the app that I'm coding and then get notifications in a pushover app on my iphone. However, ideally, I'd like to receive the notifications in my app, not in the pushover app, because I don't want users to need to have pushover in order to use my app and because I want users to receive their own distinct notifications, not notifications for everyone.
Does anyone have suggestions on how I should handle this issue?
Thanks for the help!
EDIT
This isn't a duplicate of this question: Does firebase handle push notifications? because I know Firebase doesn't directly handle push notifications. I'm looking for the best indirect way of handling push notifications with Firebase.
Now Google rebranded GCM to Firebase Cloud Messaging and it now offers this cross platform service. Firebase also offers notifications.
These are the differences between these two services:
Firebase Cloud Messaging provides a complete set of messaging
capabilities through its client SDKs and HTTP and XMPP server
protocols. For deployments with more complex messaging requirements,
FCM is the right choice.
Firebase Notifications is a lightweight, serverless messaging solution
built on Firebase Cloud Messaging. With a user-friendly graphical
console and reduced coding requirements, Firebase Notifications lets
users easily send messages to reengage and retain users, foster app
growth, and support marketing campaigns.
If you want a more detailed comparison. Read this.
If you want device to device push messages and not just server to device, the only solution I found was OneSignal. I was able to add basic device to device push message support for my app in about an hour and it is currently free.
Both Batch and Firebase only support server to device push messages, not what you want for a chat app
There are a couple of options: (well, more than a couple but here's two)
Parse handles push notifications very very well - they have that down pat and it's super simple. However, you may have issues with users and accounts - depending on what your app does.
You mentioned Pushover. We worked their API a while back but not through Zapier. If I remember correctly, I believe you can simply register your app, send an HTTPS: request to their server and then the notifications are sent from/to your app.
Also, you may want to evaluate how you are using push as it's possible you can roll a notification-like event just into the app itself.
Here's the answer I got from the Firebase team:
Firebase currently does not have push notification feature. You can use Firebase Queue and GCM to implement push notification in your app. Queues can be used in your Firebase app to organize workers or perform background work like generating thumbnails of images, filtering message contents and censoring data, or fanning data out to multiple locations in your Firebase database. Google Cloud Messaging (GCM) is a free service that enables developers to send messages between servers and client apps and it is available in both iOS and Android.
You can push an object with some data to the /queue/tasks location in your Firebase using any Firebase client or the REST API. Workers listening at that location will automatically pick up and process the job. From that, your workers can make a GCM push notification.
(end of message from Firebase team)
~~~~~~~~~
Here's my analysis:
It seems like there are a few solutions, but the two best ones are:
1) Use FirebaseQueue with Google Cloud Messaging.
2) Leverage the Push Notification functionality in Parse within the Firebase app.
I'm not sure which is better. Parse seems more proven, but Firebase Queue is more-easily integrated into the app (ie. it's nice have everything on Firebase and not having to set up a Parse app)
Anyways, I hope this thread helps out other people!
Just realized that they've come out this:
Batch
Firebase now has Notifications inbuilt.
https://firebase.google.com/docs/notifications/
I had the same problem and managed to figure out a solution a while back. I have detailed my solution in the following posts https://stackoverflow.com/a/44192515/7048719 and https://stackoverflow.com/a/42240984/7048719
You have to create a firebase data service class and use a shared instance to hold the observers in memory when the app goes into background. From there it is just a matter doing what you wish.

Push notifications not received in some devices in iOS

I am implementing the push notification in iOS for sending offers and deals. Right now I am working in the development environment. I see that some of the devices are not being notified. Could anybody explain possible causes? I have also read that if a push is sent to same device multiple times then APPLE disables them for that particular device? Could some one verify this or provide any documentation where I can find the issue. Any feedback would be appreciated.
Not directly answering your question, but what you asked about in the comments and an alternative. You could use a push-notification service such as Parse.
They allow you to send Push Notifications to Web, iOS and Android, also offer data storage and backend infrastructure. The best thing about Parse is that they're free. Unless you have one million unique recipients, which is rather hard to accomplish. Parsee allows you tons end Push Notifications in multiple ways, some including automatic messages based on their tables or other events. You can program those in their cloud code. You can do so using their REST API or their Java Script API if you have a website. You could also send from the Push window on their website.
Setting up is fairly easy. I'll give you the most important links below.
iOS Quick Start Guide
Rest API
PHP Guide
Hope that helps, Julian
If you are dependent on APNS then there is no guarantee provided regarding the delivery of the push notification. And regarding sending multiple notifications. Like if you send notification every min then many may not deliver. Else it will. This service is free and many including myself using it on a regular basis. It has been delivered regularly even though apple will not provide any guarantee. i'm using a php script on server side to send push notification. Refer the below link if you want to know how to send a push notification using php.
tutorial

BlackBerry: how to send messages (pin, mail, sms) to multiple subscribers automatically?

I'm planning to do an BB app. But I don't know if it is possible. I ask for your recommendation.
It will consist of two apps.
The first: the user will download it. He will be subscribed to the app, sharing his mobile number, PIN, and mail (could this be done automatically? This is, without the user typing that info and sending it)
The second: the admin will send messages of different nature (sms, mail and/or pin) to the subscribers of the first app.
Summarizing: I would like to send messages (of different kind) to many users. I looked, and, at least, in the BB API is possible to send mails to multiple users. But, how to do it with sms and pin.
Also, how would be the code logic that subscribe the users? Could be done automatically? If not, do I need a dedicated server to store the info of the users? etc.
If you have a more elegant way to achieve what I'm posting, please, let me know.
It sounds like one of your requirements is to originate the messages from a BlackBerry. This may be inefficient and costly.
The best solution to send data to multiple BlackBerry users is the Push Service which you can read about here: http://us.blackberry.com/developers/platform/pushapi.jsp

Resources