Android Question Late in Notifications

pazzokli

Active Member
Licensed User
Longtime User
Hi all,
In the last (about) 3 month I've a problem with notifications of my app.
I use Firebase. Notifications arrive with several seconds of late, 30-40 seconds.
I try to update my app using Receiver instead Service according to last information but no improvments.
You have same problems or not?

Thnks
Roberto
 
Code:
private Sub SendMessage(Topic As String, Title As String, Body As String, Mandante As Int)
    '''''''''''''''''''''''''''''' NOTIFICA '''''''''''''''''''''''
    Dim Job As HttpJob
    Job.Initialize("fcm", Me)
    Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
    Dim data As Map = CreateMap("title": Title, "body": Body, "mandante": Mandante)
    m.Put("data", data)
    Dim jg As JSONGenerator
    jg.Initialize(m)
    Job.PostString("https://fcm.googleapis.com/fcm/send", jg.ToString)
    Job.GetRequest.SetContentType("application/json")
    Job.GetRequest.SetHeader("Authorization", "key=" & API_KEY)
End Sub

I don't remember where I got this code and where take API
 
Upvote 0
I use Firebase. Notifications arrive with several seconds of late, 30-40 seconds.
 
Upvote 0
Thanks Alexander, first of all I try to re-ceate a projet in Firebase console.
I appreciate your contribute!
 
Upvote 0
The problem is rather that Google delays the sending after a certain time.

 
Upvote 0
But what about switch from API FCM legacy to HTTP v1?
I tried using the older API (legacy) and the newer API (v1) and had the same result. The legacy version is meant to be turned off soon.

first of all I try to re-ceate a projet in Firebase console.
I had my Firebase project created for many years (4-5 years, maybe longer) and it was working perfectly fine. Then since around mid-end of April the FCM were being delayed in being delivered to the phone for some reason.

I found if I create a new firebase project the push notifications are fairly instant and then all of a sudden (1-2 weeks later) it is slow again and they are delay in being delivered. This was for both Android and iOS when using Firebase.

I even created 2 separate firebase projects, one for Android and another for iOS, thinking maybe I am sending too many API calls to the same project but both my new projects are now slow. I even logged how many API calls I am sending and the API calls are not the issue.

At one point I stopped all API calls to Firebase for a whole week (for the project that was running slow) and I then only sent 1 API call for FCM but my phone didn't get the message for 1-2 minutes.

When I send the firebase API call, it get's the JSON reply saying Firebase accepted the API call but just a delay in receiving the FCM on the phone.

So creating a new project in Firebase is a temporary solution for a few weeks.

I love to try pushy.me or anything other than Firebase to see if we get the same result.
 
Upvote 0
I'm writing new code for HTTP V1, but I need send notification from Android and I don't know how to do beacause Erel's example is for B4J.
 
Upvote 0
I need send notification from Android and I don't know how to do because Erel's example is for B4J.
Check this answer from Erel:
"Try to use the B4J code with the dependencies. I don't know whether the dependencies are compatible with Android. They might."
 
Upvote 0
Check this answer from Erel:
"Try to use the B4J code with the dependencies. I don't know whether the dependencies are compatible with Android. They might."
It doesn't work
 
Upvote 0
Back
Top