Can Firebase Data Messages be disabled by iPhone users? - ios

Do Firebase Cloud Messaging Data Messages need to be allowed by an iPhone user and can he disable them in the iPhone's Settings app?
I know that this is required for "Notification Messages". But Firebase "Data Messages" seem different. I do not want to show any visible notification to the user. I just want to ping the iPhone app if and when data in the backend were updated to let the app know that it needs to refresh its data from the server. This is meant to happen in the background without the user noticing.
The aim is to avoid having the app frequently "pull" and ask the backend whether a data refresh is needed. But if "Data Messages" can be disabled by the user, I will not use them as a vehicle to keep critical app data in sync.
Thanks!

Related

Force Firebase to send analytics data upon backgrounding?

I'm trying to figure out where users of my app lose interest during the onboarding process. To that end, I've implemented Firebase Analytics. However, it seems that in the scenario where the user only uses the app once never to open it again, the collated analytics data are never uploaded to Firebase. Only when the app is launched a second time, the data are being uploaded.
Does Firebase Analytics have a means of forcing the uploaded upon app backgrounding?
There is no way to force the Firebase Analytics client to send its data to the server at any specific time.
But as Todd says in his blog post How Long Does it Take for My Firebase Analytics Data to Show Up?:
On iOS devices, Firebase will also send down data when your app moves into the background. So if a user tries your app for 20 minutes and then uninstalls it, that session data will still be received, because your app will have sent down the data the moment the user moved your app to the background.
The only caveat to this:
The one corner case where analytics data would actually get lost on iOS would be if your app crashed and then your user immediately uninstalled it.
So it looks like the analytics data should be sent to the server if the user background the app. If that doesn't happen for you, can you describe the flow of your users whose data is not showing up more explicitly?

How do I get notifications sent to each device when a child is added, using Swift and Firebase?

I have a fully functioning application that uses Firebase as a backend. I want to be able to have a user receive a notification when a child is added to my Firebase database under that users ID.
I have looked everywhere but all I can find are links to OneSignal or people telling me to "make a custom server" as if it can be done by magic. How do I go about making a server? What language? What do I do with OneSignal? Can someone guide me step by step without telling me to simple make a custom server.
I believe Cloud Functions for Firebase is exactly what you're looking for. Specifically, Realtime Database Triggers:
The Realtime Database supports the onWrite() event, which triggers anytime data is created, destroyed, or changed in a specified database location.
In a typical lifecycle, a Firebase Realtime Database function does the following:
Waits for changes to a particular database location for write events.
Fires when a write event occurs and performs its tasks (see What can I do with Cloud Functions? for examples of use cases).
Receives an event data object that contains two snapshots of the data stored at the specified path: one with the original data prior to the change, and one with the new data.
And going through the What can I do with Cloud Functions?, theres Notifying users:
Notify users when something interesting happens
Developers can use Cloud Functions to keep users engaged and up to date with relevant information about an app. Consider, for example, an app that allows users to follow one another's activities in the app. In such an app, a function triggered by Realtime Database writes to store new followers could create Firebase Cloud Messaging (FCM) notifications to let the appropriate users know that they have gained new followers.
The function triggers on writes to the Realtime Database path where followers are stored.
The function composes a message to send via FCM.
FCM sends the notification message to the user's device.
To review working code, see Send FCM notifications.
Other interesting notification use cases
Send confirmation emails to users subscribing/unsubscribing to a newsletter.
Send a welcome email when a user completes signup.
Send an SMS confirmation when a user creates a new account.

Send some data to contact from app (Objective-C, Swift)

Is there any way I can send some data to contact from contacts app? for example some string or integer? E.g. I have an app, when user open it the app shows all contacts from Contacts app. and when he tap one of the contact the app must send data to the persons phone. Must I do it with web service or there is any way to do it without web service?
P.S. sorry for my english!
There is no way to do this using built-in iOS libraries without invoking a UI. You can send an SMS message using the MFMessageComposeViewController class. That displays a UI to the user. If I remember correctly you can prepopulate the view with the content you want to send, but the user can edit it.
Likewise there is the MFMailComposeViewController for sending email, with or without attachments.
If you want to send data to another user without displaying a UI to the user you will need to either use a webservice or come up with your own system (involving a server you manage, a TCP socket connection between copies of your app running on both devices, or some other custom development)

Will multiple push notifications opt-ins be an issue with iOS?

Quick question, if I develop an app and create a dedicated "alerts screen" and on that screen will be a list of 200 teams, next to each team will be "news" and "transfers".
So the user has the option to opt in to push notifications for only the teams they choose but also narrow down to just news or transfers for example.
Will this be an issue with iOS? I know Parse and others allow "segmentation and channelling" but I am not sure if this is the best way as my app has no user login/registration, I will be doing it via device token.
It won't be an issue with iOS, as long as you plan to support this functionality in your server - once the user chooses the types of notifications they prefer to see, you'll send these types along with the device token to your server and store them in your DB. Your server will send push notifications to each device token based on those preferences.
That being said, a UI screen with 200 options to choose from doesn't seem very user friendly. You should think how to make it less painful for the user to make those choices.

Web App Interfacing with iOS app for push notifications

I have a basic web app that is able to send push notifications (via UrbanAirship) to my iOS app.
My questions is, how can my webapp know that I have a new iOS app user? So I can then put the push DeviceID into a database (along with other data as required).
i.e. what is the interface for getting data into the Webapp, is it new code in the iOS app, or is there some other interface from UA?
Thanks..
I'm not an iOS developer, so it's hard for me to be too specific, but I'm assuming you need to store a device ID and (possibly) a token so that you can send messages to that device. I'm assuming (also) that you have access to this information on the device.
The correct way to do this would be to create datastore table of devices and the information associated with them (tokens, various IDs, I also like to have the last time I sent them a message, etc.) Then you send a request (should be a POST request, semantically) to your app when the user registers their device. Send the information you need in the POST request, then store it in your datastore through a handler.
Hope that helps? That's how things are done with Android Cloud to Device messages, and from my quick perusal of Urban Airship, that's how their service works, too.

Resources