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

Status
Not open for further replies.

Noorul HAQUE

Member
Licensed User
Hi All

I am trying to develop Android App with Firebase Push messaging, I have done following I am using B4A6

1) Created account and App in Firebase
2) downloaded google json file , copied to App folder
3) Edited Manifest file added Google Play Services Base, Firebase Base, Firebase Notification
4) in #Region Project Attributes I added #AdditionalJar: com.google.android.gms : play-services
5) now when I am making Private fm As FirebaseMessaging it showing : unknow type , are you missing a library reference ?

Please advice me if any thing I am missing ...
 

KMatle

Expert
Licensed User
Longtime User

jayel

Active Member
Licensed User
Longtime User
I get this on compiling :
B4A version: 6.00
Parsing code. (0.00s)
Compiling code. Error
Error parsing google-services.json:
Error parsing json file. Make sure that the package name is correct.

Package name is "#ApplicationLabel: testpush"
And project name in firebase is also testpush

Probably a stupid question, but do you have any pointers what the solution is please?
 

DonManfred

Expert
Licensed User
Longtime User
Package name is "#ApplicationLabel: testpush"
That´s NOT the packagename! Press CTRL-B in the IDE to see the packagename.

It must be the same as you defined in firebase console before you download the json file from the console.
 

jayel

Active Member
Licensed User
Longtime User
android side is compiling but the FCMPush on B4J give this on compiling :
 

Noorul HAQUE

Member
Licensed User
Dear Team,

I facing two problems with Firebase Notification,

1st Problem

Firebase notification is only happening if my application is in background working mode, ie, If I am in my App, I am not receiving any notification.

2nd Problem

I have defined newMessage as global variable

Sub Process_Globals
Dim newMessage As Boolean
newMessage = false


and in FireBaseMessaging I have code as below where I have set newMessage as True


Sub fm_MessageArrived (Message As RemoteMessage)
Dim n As Notification
If Message.GetData == Null Or Message.GetData.Get("title") == Null Then
Return
End If
n.Initialize
n.Icon = "icon"
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body") , Main)
Main.newMessage=True
n.Notify(1)
End Sub

Now my problem if I access this variable from Main Module, its value still false even after notification message. My requirement is to set this variable true if any notification arrives, I also tried to save this value in a text file upon receiving notification that also not working.

Please support me on this, thanks in advance.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…