Android Question Push Notifications will not be sent

SMOOTSARA

Active Member
Licensed User
Longtime User
Hey guys
I've used the FirebaseNotifications in my application

I will send data from Google And everything is fine.


Android versions 4 will receive notifications if the program is open or closed And everything is fine
but
On Android 7, only notification is received when the application is open
Push Notifications will not be received when the program is closed

B4X:
#Region  Service Attributes
    #StartAtBoot: true
    #StartCommandReturnValue: android.app.Service.START_STICKY
#End Region

What's the problem؟
 

KMatle

Expert
Licensed User
Longtime User
You need to understand that the service is started automatically without doing anything (take the example as it is. Just a simple service. Nothing more. Really.). Ask yourself: Who or what starts the service if a message arrives?

a) magic
b) Android OS via Firebase Messaging
c) let's start it sticky and at boot. The video and the example told me to do so. This is ok and will not interfere anything.

Next question: How do we send messages?

a) In the example they told me to use the console
b) via api using OkHttpUtils

Last one: Are there different types of messages and do they cause different behaviours of my app?

a) no. There is just one type. I'm good.
b) if he asks there might be different types. Maybe I take a search. Probably Google has examples and explains the different types
c) data messages
d) notifications
e) mixed (data and notifications)
f) I use the console and I've seen some options but I don't care
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
I really recommend you to see the video tutorial as there are 3 mistakes in your post...


hi Erel
I looked at the video carefully
My problem has not yet been resolved
I will explain my problem again.
I send a data from Google Firebase to all devices
When the app is open, "Google receives" get data correctly (Photo number one) and show push notification and ...
But
when the app is not open,"Google receives" does not respond and logs are free and data will not be received until the application open
After the program is open the "Google receives"is activated and receives the data and show push
It's interesting to me that on devices with Android version 4 this is not the problem and the information is received but on devices with Android 7 version and above this problem exists.
b4a ver 8.0
 

Attachments

  • 2.PNG
    10.8 KB · Views: 233
  • 1.PNG
    57.7 KB · Views: 245
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Did you check phone settings for push notifications ? Many manufacturers use own firmware with strange default settings. For instance, Xiaomi.
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
The video explains that you should never use Firebase console to send messages. You need to use the B4J code.

hi Erel
I use b4j for sending data but my problem is not in the sending data.

It's interesting to me that on devices with Android version 4.. this is not the problem and the information is received but on devices with Android 7.. version and above this problem exists.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…