Google has deprecated the previous method of sending push notifications. It will stop working on June 2024. If you have an already working solution then you only need to update the B4J side. Do make sure that you switched from the service to a receiver on B4A. The new API is (confusingly) named...
www.b4x.com
But now I'm trying to figure out a way in which the user can temporarily "mute" the notifications and then "unmute" them as needed. I can't seem to find any way in the example above (the B4I part) that will allow me to add or modify the code to temporarily disable notifications and then re-enable them. I realize that iOS apps don't run in the background, but I have seen other iOS apps that will allow you to temporarily mute these notifications when too many have been received without having to do so in the main phone Settings.
Has anyone accomplished this? Any ideas or suggestions? ...... Thanks!
Google has deprecated the previous method of sending push notifications. It will stop working on June 2024. If you have an already working solution then you only need to update the B4J side. Do make sure that you switched from the service to a receiver on B4A. The new API is (confusingly) named...
www.b4x.com
But now I'm trying to figure out a way in which the user can temporarily "mute" the notifications and then "unmute" them as needed. I can't seem to find any way in the example above (the B4I part) that will allow me to add or modify the code to temporarily disable notifications and then re-enable them. I realize that iOS apps don't run in the background, but I have seen other iOS apps that will allow you to temporarily mute these notifications when too many have been received without having to do so in the main phone Settings.
Has anyone accomplished this? Any ideas or suggestions? ...... Thanks!
Yes.. correct. However, how do you programmatically suppress or allow the notifications. The firebase events in the example don't fire when a notification is to be sent out. There may be other events that I am not aware of - - - -
Yes... as soon as I try it out and make sure that it works. Thanks!
Edit:
Yes, this works perfectly. Here are the details in case anyone else needs to do this in B4I:
Referring to the link to Erel's example in Post#1
1. Added a checkbox in designer - "chkMute"
2. Added the following Sub in module - "FirebaseMessaging"
B4X:
Public Sub UnSubscribe (Topics() As Object)
For Each topic As String In Topics
fm.UnsubscribeFromTopic("ios_" & topic)
Next
End Sub
3. Added the following Sub in module - "B4XMainPage"
B4X:
Private Sub chkMute_CheckedChange(Checked As Boolean)
If Checked Then
CallSub2(FirebaseMessaging, "UnSubscribe", Array("general"))
Else
CallSub2(FirebaseMessaging, "SubscribeToTopics", Array("general"))
End If
End Sub
I thought on the opposite way which is instead: check to receive notification, uncheck to stop receiving notification.
You may have more than one checkboxes with different topics.
e.g I want to receive notification on product updates I want to receive notification on promotions I want to receive notification on new messages
But it is not right or wrong. Just how the way you design your app.
I thought on the opposite way which is instead: check to receive notification, uncheck to stop receiving notification.
You may have more than one checkboxes with different topics.
e.g I want to receive notification on product updates I want to receive notification on promotions I want to receive notification on new messages
But it is not right or wrong. Just how the way you design your app.
Correct - I designed it as a "Mute" check box. So when checked, notifications are muted. In my app, the notifications are for an alarm.
My goal is to temporarily mute notifications for the next (say) 10 notifications and then automatically unmute them. That way the user is not bothered with continuous notifications for a while. But in case he/she forgets to turn them back on, it does it automatically.
Now I need to figure out how to count the notifications ..... but that's another story ......
Yeah ... but this is an App that is used "internally" to send an alert for an alarm condition and will not be available to the public. The user's are all known to me (friends/colleagues) and they know I do a lot of things to them without their consent or knowledge They don't care and neither do I. The purpose of the notifications is really to drive them crazy until they take action and find out the cause of the alarm and clear it. However they pleaded with me to give them a break while they worked on the situation and so here I am, doing so .... this will make them very happy!
Actually, instead of counting the notifications, I'm just going to let them mute the notifications for (say) 4 hours. If the alarm condition is not cleared by then, the notifications will resume and start bugging them again.