Hello All,
I'd like my server app (B4J) to send a message directly to a device when something happens on the server. I understand we can use FirebaseMessaging.Token to achieve this. I am doing the following:
What I have found challenging is:
I know these are quite a lot of questions in one post but I think they are all related to the subject of better understanding FirebaseMessaging.
Many Thanks,
Haris.
I'd like my server app (B4J) to send a message directly to a device when something happens on the server. I understand we can use FirebaseMessaging.Token to achieve this. I am doing the following:
- In FirebaseMessaging service, in SubscribeToTopics sub, I store the token on the server db against the device UDID.
- From the B4J app, I send a message to the topic and include the token in the 'to' parameter.
What I have found challenging is:
- FirebaseMessaging.SubscribeToTopics does not appear to be called if the app was not running in the background. For example, the user killed the app from the recents list. This, in my observation is frequently done by casual users either because they are bored or because they perceive this way they will save battery or memory or improve performance. Whatever the reason, when the app is launched again, I do not see that SubscribeToTopics was invoked again however I see this line in the log after (FirebaseMessaging start) ...'sending message to waiting queue (CallSubDelayed - SubscribeToTopics)'.
- What is the life of the firebase token? How do we know it has expired?
- What is the impact of calling SubscribeToTopics? Will calling it again result in a new token being returned? In some of my tests this has happened.
I know these are quite a lot of questions in one post but I think they are all related to the subject of better understanding FirebaseMessaging.
Many Thanks,
Haris.