Android Question [SOLVED] VB.NET send Null notification to android (Firebase)

makis_best

Well-Known Member
Licensed User
Longtime User
Hi.

I want through a VB.NET application I created
to send notification messages to all users they
use my Android application using Firebase services.

My code working fine and notification messages take place
but only when Android application running in the background
or the application is closed. If the application is running then
the notifications come writing only Null on body and tittle.

What I am missing here?
Is there something else I need to look after?

The Json I use is like that.
B4X:
Dim data = New With {
                .[to] = deviceId,
                .notification = New With {
                    .body = MaterialComment,
                    .title = "Αλλαγές τιμών.",
                    .sound = "Enabled",
                    .click_action = "Main"
                }
            }
 

Peter Simpson

Expert
Licensed User
Longtime User
@makis_best not unless you have a good reason not to do so, If I were you I would be using firebase push notifications.

I developed a solution for one of my clients a couple of years ago which works 100% perfect 100% of the time. You might find it a lot easier to use a B4J application to push notifications to either Android or iOS devices.

 
Upvote 0

makis_best

Well-Known Member
Licensed User
Longtime User
@Peter Simpson thank you for your reply.
The exact example I use from Android part.
I just can't use B4J example cuz the VB.Net
application already used for years now and do
many many things. One of all that things to do
are and notification messages.

I don't want to use two separate apps...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
How about adding title and body to data?
B4X:
Dim data = New With {
                .[to] = deviceId,
                .title = "Αλλαγές τιμών.",
                .body = MaterialComment,
                .notification = New With {
                    .title = "Αλλαγές τιμών.",
                    .body = MaterialComment,                  
                    .sound = "Enabled",
                    .click_action = "Main"
                }
            }
You can also check my VB.NET code
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
@aeric I check your code and we don't have differences.
Actually your code work both ways?
What do you mean both ways? Do you mean "notification" and "data" ?
Let us understand, if we send notification, we only can send title and body (and set sound), the notification sent by Firebase Push Notification does not carry any "payload".
That is why it is a better way to send "data" and let B4A app to handle the "message" in fm_MessageArrived() sub and raise an internal notification.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hi @makis_best

Can you give me an example in VB.NET of how to send the notification by FireBase

If you want, can you inform me how can I do it? I only have the example in B4J

I appreciate you so much
 
Upvote 0

ddefrain

Member
Licensed User
Longtime User
@aeric you correct... After I change
B4X:
.notification = New With {
to
B4X:
.data = New With {
everything works as it should be.

Thank you all for your help.
In a few words firebase tooks the notification word as a command (I think), use a different word
Thank you very much
Best regards!!!
 
Upvote 0
Top