Cadenzo Active Member Licensed User Longtime User Dec 16, 2018 #1 If a new message arrived, I want to download some data from the server. this is allwais done, when the App starts. But if it is allready started, I set b_NewMsgArrived = True. Then the server also will be visited. Code in the FirebaseMessaging: Code: Copy Sub fm_MessageArrived (Message As RemoteMessage) Starter.b_NewMsgArrived = True NewMessage(Message.GetData.Get("title"), Message.GetData.Get("body")) Log("Message arrived") Log($"Message data: ${Message.GetData}"$) End Sub Code in Main: Code: Copy Sub Activity_Resume If Starter.b_NewMsgArrived = True Then GetNews(True) End Sub But if the app is in the backround (the phone is turned off), it does not work. I get the notification, that new message is arrived. This means, that fm_MessageArrived is fired, right? But b_NewMsgArrived is never true. It is hard to debug, because the firebase notificatin olny works in release mode. Any suggestions? Last edited: Dec 16, 2018
If a new message arrived, I want to download some data from the server. this is allwais done, when the App starts. But if it is allready started, I set b_NewMsgArrived = True. Then the server also will be visited. Code in the FirebaseMessaging: Code: Copy Sub fm_MessageArrived (Message As RemoteMessage) Starter.b_NewMsgArrived = True NewMessage(Message.GetData.Get("title"), Message.GetData.Get("body")) Log("Message arrived") Log($"Message data: ${Message.GetData}"$) End Sub Code in Main: Code: Copy Sub Activity_Resume If Starter.b_NewMsgArrived = True Then GetNews(True) End Sub But if the app is in the backround (the phone is turned off), it does not work. I get the notification, that new message is arrived. This means, that fm_MessageArrived is fired, right? But b_NewMsgArrived is never true. It is hard to debug, because the firebase notificatin olny works in release mode. Any suggestions?
Cadenzo Active Member Licensed User Longtime User Dec 16, 2018 #2 OK, I found the reason may be here in post #10. When my server sends the pushups only with "data" it works. But than it is not shown as notification in iOS. In iOS I need the "notification" part. I use a own server, that handles all tokens and app-IDs. So the messages from one App to another are sent to an app-id of the reciever. I have apps for android and iOS. Any ideas, how it could work for both? The "notification" part is needed for iOS, but it is also the reason for the bug in post #1. Upvote 0
OK, I found the reason may be here in post #10. When my server sends the pushups only with "data" it works. But than it is not shown as notification in iOS. In iOS I need the "notification" part. I use a own server, that handles all tokens and app-IDs. So the messages from one App to another are sent to an app-id of the reciever. I have apps for android and iOS. Any ideas, how it could work for both? The "notification" part is needed for iOS, but it is also the reason for the bug in post #1.
KMatle Expert Licensed User Longtime User Dec 16, 2018 #3 Not a bug. Works like is is meant to be. Use mixed messages (search for FCM here or see Google docs about the different types & their behaviour) Upvote 0
Not a bug. Works like is is meant to be. Use mixed messages (search for FCM here or see Google docs about the different types & their behaviour)
Cadenzo Active Member Licensed User Longtime User Dec 16, 2018 #4 So I solved it now on the server itself. The apps now register on the server not only with ID, Pin and Token, but also with its system android/iOS. And depending on that, the server includes the "notification" part in the payload or not. Upvote 0
So I solved it now on the server itself. The apps now register on the server not only with ID, Pin and Token, but also with its system android/iOS. And depending on that, the server includes the "notification" part in the payload or not.