Android Question Notification delay_while_idle = true

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi, I would like to know how I can set delay_while_idle = true in firebase notifications, since I think I have this problem.
I need the message to be sent when the device is active, otherwise they do not arrive.
regards!!!!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I need the message to be sent when the device is active, otherwise they do not arrive.
What do you mean with not active? Messages should arrive if the device is turned on and connected to the internet.
If they don't arrive then you have probably didn't implement it properly.
 
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi Erel, if I send a notification to a device that is off, messages never arrive when it is turned on and connect to an Internet, it reads in the Firebase documentation that this statement must be in true, by default it is false.

In another thread, I could already show them my code and seems to be correct with the example.
https://www.b4x.com/android/forum/t...base-are-randomly-received.78038/#post-494867


As an additional data, when the device is turned on, the sound of the notification is heard but not displayed, nor the new ones that can receive, it is rare this happens when I set the priority in 1, to try to get the messages to enter, but it does not work .
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
As an additional data, when the device is turned on, the sound of the notification is heard but not displayed, nor the new ones that can receive, it is rare this happens when I set the priority in 1, to try to get the messages to enter, but it does not work .
You haven't answered my question in the other thread. Are you sending the messages with the B4J code?

If you want new messages to show when there is already a message then use a different id for the notification.
 
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi, Erel, Thanks for replying. If I am using the same code as B4J, I also check Kmatle in the thread. I notice that if the target device has no mobile data or internet, the sent messages are then received when it is connected, This is not the case when the deviceis turned off. So I thought of the function delay_while_idle = true, which I read in the Firebase documentation, by default it is set to False, this would cause the notifications to be sent only when the device is online, solving the problem, I do not know if I am wrong . Regarding the Id, put a global variable to assign a different id to each notification, and that worked well, is it the right way? regards
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi, Erel thanks for replying. Make the change to create an id, but I do not solve the problem. If I send one or more notifications to an off device, it never received notifications once it was turned on. Honestly I do not know what it can be, the only clue I had was to set delay_while_idle = true, but you tell me it would not work. I honestly do not know what it can be, and I already publish the app :(. Thank you very much, I appreciate the help you can give me
 
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hello, Erel! I am testing the code with the addition of the function nb.priority = 2, and have entered the messages sent when the device was off, I will try a little more, you think that could be this the final solution?:)o_O
 
Upvote 0
Top