Android Question Firebase Background Notification

fbritop

Active Member
Licensed User
Longtime User
How do I manage to get a system notification, when the app is in background, that plays a custom sound?
in B4I there is no problem, but in Android I cannot get it done, with a simple JSON through firebase (no notification builder, not anything special, just a notification)

B4X:
{"registration_ids":["e-aknu4Curg:APA91bHcQQ_hmBxQEihxYXpEIKtRX1xRnLHd-CCja8_38LQ8ciZNM4K3JphNojMzTp49UnXBN07G4ue0VgNEfDdzAo8vw2VCnp4LvrjgxAJ_*****************************"],"time_to_live":30,"priority":"high","content_available":true,"notification":{"sound":"beep","title":"TITULO","body":"CUERPO","color":"#ff0000","image":"https://www.gstatic.com/devrel-devsite/prod/v8ea8343deca3e735c5e491f22b0e2533427dcd1d0302777baea2667771626911/firebase/images/lockup.png"}}

I know that it fetches OK, because I tried without image and with, and the notification changes.

The sound file is in the assets, and also put it on objects/res/raw (for some comments I found on Stack Overflow)

Thanks in advance
 

Ertan

Active Member
Licensed User
How do I manage to get a system notification, when the app is in background, that plays a custom sound?
in B4I there is no problem, but in Android I cannot get it done, with a simple JSON through firebase (no notification builder, not anything special, just a notification)

B4X:
{"registration_ids":["e-aknu4Curg:APA91bHcQQ_hmBxQEihxYXpEIKtRX1xRnLHd-CCja8_38LQ8ciZNM4K3JphNojMzTp49UnXBN07G4ue0VgNEfDdzAo8vw2VCnp4LvrjgxAJ_*****************************"],"time_to_live":30,"priority":"high","content_available":true,"notification":{"sound":"beep","title":"TITULO","body":"CUERPO","color":"#ff0000","image":"https://www.gstatic.com/devrel-devsite/prod/v8ea8343deca3e735c5e491f22b0e2533427dcd1d0302777baea2667771626911/firebase/images/lockup.png"}}

I know that it fetches OK, because I tried without image and with, and the notification changes.

The sound file is in the assets, and also put it on objects/res/raw (for some comments I found on Stack Overflow)

Thanks in advance
NB6 ibrary into your own project.
I was dealing with this issue to. This is how I came to the solution.
in B4I there is no problem
Can I find out how you do this on B4i?
 
Upvote 0
Top