Android Question Firebase Notification Custom Sound and Icon Change

Ertan

Active Member
Licensed User
Hello there
I am sending notifications to ios and Android via firebase.
(When the application is closed)

I want to change the icon and play a special sound.

it is said that for this, icon file should be thrown everywhere in "Objects\ res\ drawable" folder. But b4x is deleting the files I have put in my drawable folder.

In this video, icon and sound change is made via Android Studio. (15:00)

But I can't do it as in the video.

How can I do this that way?

Is there any way to do it without using the NB6 library?

Can you please explain it in an explanatory way? I did a lot of research on the forum but couldn't succeed.

I can send notifications to anyone I want without any problem, but I could not change the icon and notification sound.
 

Ertan

Active Member
Licensed User
I am sending notifications to ios and Android via firebase.
(When the application is closed)
I want to change the icon and play a special sound.
Since I do not know about this subject, I want to ask.

Can I output different sound notification with NB6 when the application is closed?

or

Can I make different notification sounds without using NB6 thanks to Firebase without any library intervening?

If I can get it out, is there a sample?

I still haven't got the answer to my question.
 
Upvote 0

Ertan

Active Member
Licensed User
You should never use Firebase console. See my answer above.
I changed both the icon and the sound with this command. The application does not matter in the background or foreground.
A few things you wrote are keywords, thank you for that for me, but there is one more problem. I think this is due to the code written;

The application opens automatically after the notification is dropped on the phone.

This might work for me in some situations.

How can I cancel this?


B4X:
    Dim ringtone As String="shotgun.mp3"
    Dim rp As RuntimePermissions
    Dim folder As String = rp.GetSafeDirDefaultExternal("shared")
    Dim FileName As String = ringtone
    'copy the file to the shared folder
    File.Copy(File.DirAssets, FileName, folder, FileName)
    Dim n As NB6
    n.Initialize("Channel1", Application.LabelName, "HIGH")
    n.SmallIcon(LoadBitmapResize(File.DirAssets, "arac2.png", 32dip, 32dip, True))
    'disable the default sound
    n.SetDefaults(False, True, True)
    'set custom sound
    n.CustomSound(CreateFileProviderUri(folder, FileName))
    Dim Notification As Notification = n.Build(Message.GetData.Get("title"), Message.GetData.Get("body"), "", Me)
    Notification.Notify(3)
 
Last edited:
Upvote 0

Ertan

Active Member
Licensed User
What exactly do you mean?
When the notification comes to the phone, the application opens automatically.
How can I prevent the application from opening automatically?


I found the solution to the problem.

the "starter" was triggered and it was automatically hurting as the facebook was logged in. When I got a message from firebase, I didn't realize that the whole starter was starting over.

I wanted to inform if there is any living, thank you.
 
Last edited:
Upvote 0

wes58

Active Member
Licensed User
Longtime User
Since I do not know about this subject, I want to ask.

Can I output different sound notification with NB6 when the application is closed?

or

Can I make different notification sounds without using NB6 thanks to Firebase without any library intervening?

If I can get it out, is there a sample?

I still haven't got the answer to my question.
Google Description of the new notification with Channels:
Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel. For each channel, you can set the visual and auditory behavior that is applied to all notifications in that channel.
Then, users can change these settings and decide which notification channels from your app should be intrusive or visible at all.
After you create a notification channel, you cannot change the notification behaviors—the user has complete control at that point. Though you can still change a channel's name and description.
 
Upvote 0
Top