iOS Question Push Notification Sound

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using push notifications in my iOS app using Firebase.

I have multiple users using my B4i app, and each user is subscribing to the same topic.

For example:
UserA subscribes to topic 'TEST1'
UserB subscribes to topic 'TEST1'

I am using the B4j Sending Tool from the tutorial to send the push notification.

The push notifications pops up on both phones fine and uses the default tone on the device.

I understand this is because in my B4J app it is telling it to use the default tone as shown below..
B4X:
Dim iosalert As Map =  CreateMap("title": Title, "body": Body, "sound": "default")

From my understanding I need to change the 'default' value to another filename and it will play the different sound, which is fine.

The question I have is, lets say UserA is happy to get the default sound, but UserB wants to get a different sound.

How can I make UserB have a different sound than UserA, but have both subscribed to the same topic ?

From what I can see, it will be global for all users and can't have different sounds for each user, unless I make each user subscribe to different topics and send them separate with different sound values per topic ?

If the above is correct, if I use 'default' in my code, is there a way in selecting what the default tone is on the iOS device? (maybe the user can just change the default tone to something else locally on there device?)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
From what I can see, it will be global for all users and can't have different sounds for each user, unless I make each user subscribe to different topics and send them separate with different sound values per topic ?
True. You can also send to "tokens" instead of topics. In both cases you will need to have a server that manages the different keys and sounds.

If there are only few custom sounds available then you can let the users subscribe to specific topics based on the sounds:
TEST1-SOUND1
TEST1-SOUND2
TEST1-SOUND3

You can then send each message to the X topics each time (with different sounds).

The 'default' sound is a global setting that the user can change in the settings app.
 
Upvote 0
Top