Android Question Solved, Notifications stopped suddenly, any help?

Adamdam

Active Member
Licensed User
Longtime User
Dear all,
Greetings,
Notifications stopped suddenly, any help?
The keys still active/enabled.
Some of my projects totally based on notifications, any help to re-run these keys/projects ?
Best regards
 
Solution
Is this thread solved?

Please follow the forum etiquette :
Post the solution (tick the answer as solution) and mark the post as "SOLVED".

If you left/abandon a post when you got the answer like this then it is not an etiquette move. Don't expect other members want to help you in the future.

asales

Expert
Licensed User
Longtime User
As Aeric says, the notifications are sent.

Did you check the logs of the B4A app? If the notifications are received?

Which is the Android version of the device?
Did you check that the app has permission to show the notification?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Thanks Mr. Aeric.
Really I'm so sorry for your effort and time.

I read the tutorial many times, but I'll read carefully it again.
I just need to know what you meant by "and change your FirebaseMessaging service to FirebaseMessaging receiver." and how to change it?

Best regards
Download PushClients.zip
Open the project and you should notice the FirebaseMessaging file is a new file.
For old version (service), it is showed as "lightning" icon in the IDE but the new version (receiver), it is shown as "an arrow pointing to a square" icon.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Thanks Mr. Aeric.
Really I'm so sorry for your effort and time.

I read the tutorial many times, but I'll read carefully it again.
I just need to know what you meant by "and change your FirebaseMessaging service to FirebaseMessaging receiver." and how to change it?

Best regards
How add a Receiver

Project->Add New Module->Receiver Module

 
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
This Logs mean the notification is successfully sent! (last value with name key)
I can't tell whether your payload is correct or not since you didn't provide the full Logs.
Again, please please please read the tutorial and change your FirebaseMessaging service to FirebaseMessaging receiver.
Dear Mr. aeric

Many thanks for your support.
there is any project has the two folders (Sender (pusher), receiver) any simple one, as in many Erel examples, just to start from.
any simple one project, please.
that I read many tutorials, but still can't create that simple project.
Thanks on advance for your efforts.
best regards
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Dear Mr. aeric

Many thanks for your support.
there is any project has the two folders (Sender (pusher), receiver) any simple one, as in many Erel examples, just to start from.
any simple one project, please.
that I read many tutorials, but still can't create that simple project.
Thanks on advance for your efforts.
best regards
I don't mean to be rude but you need to be honest.
Are you sure this is not the first time you create a push notification app?
If you forgotten the steps, read the tutorial again and again. Yes, not once or twice.

All the instructions are quite straight forward if you REALLY have experience before.

There are only 3 steps for B4A:
B4A
1. Follow the generic Firebase integration tutorial: https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/
Download google-services.json and put it in the project folder.
2. See the attached project.
3. The notification is created in FirebaseMessaging receiver. Note that in debug mode, it will only work while the app is running.

I repeat again, start from the PushClients.zip example. It is already using receiver. Don't use your OLD project!
Follow above 3 steps especially putting the google-services.json file and replace the package name. That's all. Run the B4A project.
In B4J, open your previous Sending Tool project and run.

If you didn't change the "general" topic in B4J sending tool, the B4A app should receive the notification.
 
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
Yes, Mr. aeric,
I have many previous work with notifications, but with old methods.
I attached simple one, just simple pusher (B4A and B4J) also receptor (B4A)
If you kindly have simple like this with new technique ? please share it, or can modify attached one to run, please

Best regards
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
*taking a deep breath*

Things to check:

Firebase Console
In Project Settings (General tab), you should see :
Firebase Cloud Messaging API (V1) ✅Enabled
Unless you go disable it otherwise you don't need to do anything.

For my case, my project id is fire-push-24359.
On the same page, scroll down to check your Android apps package name. For my case, my package name is com.puterise.push.

* I think the project id is nothing confidential to the public as my API key, Client ID and private keys are kept inside the json files and this is just an example app that not available in production on Play store.

1726678734172.png

B4A

1726679435350.png


B4J

1726680958039.png


I believe you have FCMPush.b4j configured properly with the serviceAccountkey.json loaded correctly.

I can see from your previous message, your project id "musicplayer-40217" is successfully sending a notification.

My advice:
Don't confuse us and yourself with different project ids.
In post #18, it showed that your project id is "mxxn-e6975"
In post #29, it showed "addplayer-12345".
In post #38, it is showing in the logs "musicplayer-40217".

Make sure which project id you are working on is registered with the matching package name in Firebase console and matching google-services.json file in B4A project.

*since you like dark mode IDE, I post the screenshots as dark mode.
 
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
This is a simple project for (Pusher and Receptor) for notification with old notification key method
 

Attachments

  • 7_Simple.zip
    10.6 KB · Views: 48
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
why?
You are being told many times, use the new method.
I sent file before your assist.
Now, I attached new project (barcode) and added firebase to it,
I not worked, it has an error after my modifications, I attached all files as I can.
Please, help me to run this project please.
Best regards
 

Attachments

  • Fire_Testing.zip
    15.1 KB · Views: 51
Upvote 0

aeric

Expert
Licensed User
Longtime User
I sent file before your assist.
Now, I attached new project (barcode) and added firebase to it,
I not worked, it has an error after my modifications, I attached all files as I can.
Please, help me to run this project please.
Best regards
1. Use the new FirebaseMessaging.bas
2. Wrong spelling for sub name (SubscribeToTopic is wrong)
B4X:
CallSubDelayed2(FirebaseMessaging, "SubscribeToTopics", Array("general"))
3. Missing lines in Manifest editor
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)

I have tested it is working now.
 

Attachments

  • Barcode Reader.zip
    15.8 KB · Views: 42
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
Many thanks Mr. aeric for your support
But still no notification occurred.
I attached the project as it is to test direct (just delete Object folders to reduce project size)
The Pusher seam to run correctly :
1726789494818.png

Please can you test from your side again, may any name is not correct,
Note: The Notification of the receptor App is Enabled
 

Attachments

  • Fire_2.zip
    15 KB · Views: 43
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
I don't know how you test it.
If you run B4A in Debug, the app must be active in foreground.
You can also try in Release without opening the app.
Yes sir, I worked with notifications from many years ago.
I created .apk file and installed it in Mobile and even run the App for once at least.
and run pusher, and even some time make the app work not only in background mode
sure, the notification must reach whatever mobile/app state but make that may I see Toast message, but not receive any things.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Yes sir, I worked with notifications from many years ago.
I created .apk file and installed it in Mobile and even run the App for once at least.
and run pusher, and even some time make the app work not only in background mode
sure, the notification must reach whatever mobile/app state but make that may I see Toast message, but not receive any things.
This thread has grown very long.
The B4A code I provided works at my side. I only make changes to the path for serviceAccountkey.json in B4J sender tool.

I suggest you create a new post with more information.
Do you receive any message in the log or you are unable to read the data sent from the B4J tool?
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
I gave up long time. I dont see the reason why this thread should be long like this.
The Example B4J Sending Tool works. You just need to get your json and set the path, as well as replace the project name in the url.

Is he sending to a token registered in the client app?

Best Advice, he should download both files try them if it works, then he integrate them in his app, or pay someone to Google Meet/AnyDesk/Teamviewer to monitor what he is doing and correct him.

I also believe English is not his first language, hence he should post in his language forum, which he will be able to express himself very well for a solution.
 
Upvote 0

Adamdam

Active Member
Licensed User
Longtime User
Many thanks for all for your assist.
I attached the whole project (include Pusher, Receptor and Json files) to enable any gentlemen to help me just by running the project and catch the error.
and even the log result at pusher side.

Thanks on advance.

Best regards
 

Attachments

  • Fire_2.zip
    15 KB · Views: 45
  • Noti.png
    Noti.png
    15.1 KB · Views: 39
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I attached the whole project (include Pusher, Receptor and Json files) to enable any gentlemen to help me just by running the project and catch the error.
and even the log result at pusher side.
What should i say?

It just works fine here.

Output in Sender
{
"message": {
"data": {
"title": "this is the title 12",
"body": "And this is the body 34"
},
"android": {
"priority": "high"
},
"topic": "general"
}
}
{
"name": "projects/pushertesting-418f9/messages/1045723609243006626"
}
{
"message": {
"notification": {
"title": "this is the title 12",
"body": "And this is the body 34"
},
"data": {
"title": "this is the title 12",
"body": "And this is the body 34"
},
"topic": "ios_general",
"apns": {
"headers": {
"apns-priority": "10"
},
"payload": {
"aps": {
"badge": 0,
"sound": "default"
}
}
}
}
}
{
"name": "projects/pushertesting-418f9/messages/810388803603576537"
}

In the B4A app i can see a Notification.

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
*** Receiver (firebasemessaging) Receive (first time) ***
** Activity (main) Pause event (activity is not paused). **
*** mainpage: B4XPage_Disappear [mainpage]
*** mainpage: B4XPage_PermissionResult [mainpage]
** Activity (main) Resume **
*** mainpage: B4XPage_Appear [mainpage]
findCamera
null
2
facing: 0, 0
findCamera
0
2
facing: 0, 0
Preview Orientation: 90
*** Receiver (firebasemessaging) Receive ***
Message arrived
Message data: {body=And this is the body 34, title=this is the title 12}
Message data: this is the title 12
Message data: And this is the body 34
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I see Toast message, but not receive any things.
Did you check if the notification permissions are enabled?
 
Upvote 0
Top