B4A Library FirebaseNotifications - Push messages / Firebase Cloud Messaging (FCM)

Status
Not open for further replies.

ChrisKrohne

Member
Licensed User
Longtime User
Hi, I´m trying to integrate firebase
Done yet:
Update SDK,download Google repository, Android Repository
Download google-services.json with package name
edit manifest as noted (Google Play Services Base, Firebase Base, Firebase Notifications)
add #AdditionalJar: com.google.android.gms : play-services

after compiling I got the error "Maven artifact not found: com.google.android.gms / play-services"
any ideas?
Thanks!!!!
 

ChrisKrohne

Member
Licensed User
Longtime User
Hi Manfred,
thanks for the reply.
I´m not sure. But as I understand I had to add #AdditionalJar: com.google.android.gms : play-services to the code because I add google play service base to the manifest. Without the #add tag, the compiler stop with the error "AndroidManifest.xml:29: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version')."
 

Douglas Farias

Expert
Licensed User
Longtime User
Erros on google analytics report


where is the error here? i m using the sample example of first post

maybe on this line?
B4X:
If fm.HandleIntent(StartingIntent) Then Return

thx
 
Last edited:

RjCl

Member
Licensed User
Longtime User
Everything works great and device is receiving the messages.

However, i only get the message if the phone is not locked, no message is received or anything to wake the phone.

I've changed the priority to high still nothing, nor anything from firebase console is received. Only get messages if phone awake.

Any ideas please ?
 

An Schi

Well-Known Member
Licensed User
This is a limitation of the firebase console.
To wake the phone you have to send the push via http request.
 

RjCl

Member
Licensed User
Longtime User
This is a limitation of the firebase console.
To wake the phone you have to send the push via http request.

Yes, its same if i use FCMPush.jar file to send a message, it still does not wake the phone. If i awake the phone, then still no message.

I only get the message if the phone is awake at the time of sending message.
 

RjCl

Member
Licensed User
Longtime User
Yes, its same if i use FCMPush.jar file to send a message, it still does not wake the phone. If i awake the phone, then still no message.

I only get the message if the phone is awake at the time of sending message.

Got it figured out, was some settings on my phone..... "Background Task Cleaner"

Anyone else have that in their phones ? Had to whitelist app(s) that can still run in the background and not get cleared with screen lock.

Do you any others have this ?
 

Leni Berry

Active Member
Licensed User
Longtime User
i cant get the message (Log($"Message data: ${Message.GetData}"$) is null) if i send message from web firebase console in Notification Menu, but the application can detect that the message arrives.

B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
   Log("Message arrived")
   Log($"Message data: ${Message.GetData}"$)
   Dim n As Notification
   n.Initialize
   n.Icon = "icon"
   n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
   n.Notify(1)

End Sub

web Firebase Console url :
https://console.firebase.google.com/project/xxxxxchat-xxxxx/notification/compose
 

victormedranop

Well-Known Member
Licensed User
Longtime User
I dont know whats happend.

use the exact code

but no received. no error on code.
b4j result

Waiting for debugger to connect...
Program started.
[jobname=fcm, success=true, username=
, password=, errormessage=, target=class b4j.example.main
, taskid=1, [EMAIL]req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@11bc7ed[/EMAIL], tag=java.lang.Object@d84586
, httputils2service=null]
{"message_id":7015284701458445731}
Program terminated (StartMessageLoop was not called).
but nothing on logs.

can some one post and example.

Victor
 

johndb

Active Member
Licensed User
Longtime User
[SOLVED] What is the maximum size (number of bytes) permitted in the body of a Firebase message?

I apologize if this question has been previously asked but couldn't find an answer in SEARCH.

Thank you in advance,

John

[EDIT] I found the answer in the Firebase docs: "Data messages can have a 4KB maximum payload."
 
Last edited:

stari

Active Member
Licensed User
Longtime User
I get notifications, all is OK, but how i read notifications, if my application is in background and then a switch to foreground and wish to see previouslx notifications ?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…