fmmm
October 18, 2022, 8:42am
#1
Hi,
The when-then rule notifications work OK via email. But it seems that the notifications through app are never sent to the Android device.
I have the following warning on the openremote console:
manager_1 | 2022-10-18 10:28:49.138 WARNING [Messaging-NotificationQu…e-13] manager.notification.NotificationService : Error processing from REALM_RULESET - NOTIFICATION_HANDLER_CONFIG_ERROR (Handler is not valid: push): Notification{name=‘null’, message=PushNotificationMessage{title=‘test’, body=‘test’, action=org.openremote.model.notification.PushNotificationAction@67f55774, buttons=[org.openremote.model.notification.PushNotificationButton@5fea762b, org.openremote.model.notification.PushNotificationButton@60a5d6ae], data=null, priority=null, targetType=null, target=‘null’, ttlSeconds=null}, repeatFrequency=null, repeatInterval=‘null’, targets=[Target{type=ASSET, id=372y4sdaVL76jK2O3dgykk}]}
Is it necessary to add any parameters in the docker-compose.yml file for this to work?
Rich
October 18, 2022, 9:16pm
#2
Hi,
Yes you need a valid firebase config file as this is how the manager actually sends out the push notifications, you then need to compile your Android app with the matching config file.
We need to improve documentation around this; something for the list @Don
fmmm
October 19, 2022, 1:56pm
#3
Hi,
Could you guide me a little on this point? What steps should be followed?
Thank you
Rich
October 21, 2022, 7:53pm
#4
This should help:
FCM (Firebase cloud messaging) documentation:
https://firebase.google.com/docs/cloud-messaging/
Here’s the manager env variable that determines where the FCM config file is located:
https://github.com/openremote/openremote/blob/master/profile/deploy.yml#L174
The Android app that is shown in the iOS and Play stores is in our public repo and you can browse the play services config file (this is where FCM is configured):
https://github.com/openremote/openremote/blob/master/console/android/GenericApp/app/google-services.json
The iOS app has a similar config file where APNS is relayed to FCM.
1 Like
fmmm
November 9, 2022, 10:32am
#5
Thanks! this is very helpful.
fmmm
March 3, 2023, 4:26pm
#6
Hi!
I’ll ask again about this matter.
Is the fcm.json file the one downloaded when clicking on “Generate new private key” in the Firebase console, right?
It looks like this:
{
"type": "service_account",
"project_id": "openremote-xxxxxx",
"private_key_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"private_key": "-----BEGIN PRIVATE KEY-----xxxxx-----END PRIVATE KEY-----\n",
"client_email": "iot-openremote-xxxxxxgserviceaccount.com",
"client_id": "116865988193844564127",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/iot-openremote-xxxxxx.gserviceaccount.com"
}
Once the file is added in deployment/manager/fcm.json, is it necessary to add this to the docker-compose.yml file?:
OR_FIREBASE_CONFIG_FILE: ${OR_FIREBASE_CONFIG_FILE:-/deployment/manager/fcm.json}
Rich
March 6, 2023, 9:27pm
#7
Yes that file is correct and putting it in that path should be sufficient; you should see during system startup logs that the PushNotificationHandler
will try and initialise the credentials and show any errors.
Always worth remembering that if you’re using the standard deployment-data
named docker volume then you will have to prune the previous deployment-data
volume before any new changes will be picked up.