I am trying to make an app which listens to changes of the Internet API even if the app is closed, and sends push notification to the user who set up some value matching conditions with the value from the API. I am new to push motifications and I am not sure if is that possible with natvie notifications system or I have to use some 3rd parties like Firebase Messaging.
Related
We are able to send currency via the Custom data parameters in Firebase Cloud messaging (see SS below).
But if the user does not tap the notification "YOU RECEIVED 15 FREE GOLD!" then Firebase.Messaging.FirebaseMessaging.MessageReceived is never fired and the user never gets their currency. So the user may see the notification, and then be disappointed the next time they open the app and there is no gold.
Is there a way in Firebase to compose the notification so that the notification can be accessed even if the user did not tap the notification to open the app?
Without tapping on notification your application not launch and custom data you sent through notification is not received to the application. So sending custom data through firebase push notification is wrong choice in this scenario. You should sent custom data whatever you need through API is always good choice. You can also use firebase database and in that you can send custom data using nodes for respective user.
I have a doubt, I've searched and didn't find the answer, I have implemented notification in my app, is it possible to have a cancel notification in the app or it is only a system option?
When the user opens my app on the third screen it asks about sending notifications, but what if the user doesn't want to receive those notifications anymore, does he need to go to iOS settings or can I do this from the app?
Thanks for your time
If you've used react-native-push-notification or #react-native-community/push-notification-ios then there has a way to remove notification from notification center.
you can use this code to remove all natification
PushNotification.removeAllDeliveredNotifications();
Removes the specified notifications from Notification Center
PushNotification.removeDeliveredNotifications(identifiers);
check out official doc for more detail
packages:
https://www.npmjs.com/package/react-native-push-notification
https://www.npmjs.com/package/#react-native-community/push-notification-ios
If you no longer needed to receive notifications in your app, it's better to handle the logic in your backend. When the user denies permission, remove the push token from the server. If you only want to remove certain types of notifications, instead of removing tokens, you can set a flag on backend logic to enable/disable certain notifications.
If you really want to do this on the client-side, you can use data-only notifications of FCM or a similar kind, where you have the control to present notifications as local notifications. Basically, a background listener will be triggered when you receive a data-only notification and OS won't present notification. You need to create a local notification and present it according to the data you receive. Here you can add your logic to filter notifications based on User's choice
my client wants to have an UISwitch control in Settings view in his app which is: 'Disable Notifications during night time'. He would like pushes that his API will be sending to mobile to be ignored if this option is turned on and it's a night time. Is this possible? I know that I can register and unregister for remote notifications, but this requires an App to be turned on. Is it possible to have it working like he wants?
The only way to do this is to have a configuration in the back-end. Notifications are sent from a server, and only handled in the app. There is no way, besides unregistering the phone from receiving notifications, to have the phone deny a notification in a certain time frame.
The user can set a time preference in the app, send it to the server, and have the server do a check so it only sends the notification to the user in the preferred time period.
Check out this 3rd party repo to send your push notifications and just write in your own check before pushing the notification.
https://github.com/nomad/houston
You can register or unregister for push notifications, i hope in your code switch you can make something like this:
let application = UIApplication.shared
//Didnt receive push
application.unregisterForRemoteNotifications()
//Receive push
application.registerForRemoteNotifications()
and if your client wants make this in Backend you can put a value on some database table with field receive:Bool, and the backend just take all the receive == true to send push notification on this devices
I have an app that creates pdf's for the user. When this app creates a new pdf (say on the users i-pad) I want the iwatch to display a notification saying a new pdf has been created.
Does this require a server, it was my understanding apple could provide this service.
Any help or tips would be appreciated!
First to address the difference between local and push notifications. Local Notifications would be used on the specific device the user is on at the time, and is normally scheduled for a specific time such as the reminder app notifying you at a scheduled time. Push notification are sent via a server to other devices.
Since you want to send to the other devices you will want to implement push notifications. In order to do this the user will need your app on all devices. Additionally you will need to have a login system so you know which devices belong to the same user. From there you will need a push notification service that can do targeted push notifications. There are many services out there and you will need to decide which one is right for your situation.
Push notifications are sent to the device by using the device token Apple provides after the user approves notifications for your app. Each app on each device has their own device token. So in addition to targeted notifications you will want a push service that allows you to setup channels such as parse.com, that way you can setup a channel specific to each user (email, username, or ...). Then when your user logs in on any device and approves getting push notifications, their channel will be set to (whatever option you choose) and you can trigger the push notification to the specific channel and will send the notification to any device.
There are other consideration but this is a good place to start.
Local notification is just that, local to that device. Remote notification is what you need. You will either need to create a server for this purpose or use one of the variety of third-party services (Urban Airship, Parse, etc) to provide that functionality.
Clarification point -- when you say:
I want their iphone, and every other device that they have to receive a notification that a new pdf has been created
it is assumed that you mean "every device of theirs that is running your app and has approved notifications from your app". If you're trying to piggy-back on some magic AppleID-related foo, that won't be possible.
I am create a firebase based chat application for iOS. One of the features is to send push notification to the users in the same chat room (if they are offline).
I can't find a firebase function (for iOS) that can be used to send push notifications to the user.
Is it possible?
Displaying alert badges and notifications on iPhone applications is accomplished through Apple's Push Notification system. Since the application is not running on the user's phone when they receive notifications, the APN will have to be triggered from your server-side code.
You'll probably want to create a server-side module that listens for changes to your chat Firebase. When a message appears for a user that is offline, you'll have to schedule a remote notification with the APN. That latter part has nothing to do with Firebase, but has extensive documentation on Apple's developer web site.
I'm not sure if a web application can display alerts or badges. Otherwise this approach will only work if you create a native wrapper for your Firebase chat application.