Openhab-android: Delayed notifications

Created on 14 Jan 2019  路  22Comments  路  Source: openhab/openhab-android

On my OnePlus 6 notifications are often delayed until I unlock the device.

I've tried disabling all battery saving features which doesn't seem to help. I'm sure this is related to Android Pie since I've only noticed this since updating the phone, but WhatsApp doesn't seem to have the same problem (settings indicate it's using high priority messaging).

bug

All 22 comments

What exactly do you mean by 'high priority messaging'?
I'm using a OP6 on Pie (LineageOS 16) as well, and notifications seems fine for me.

If my phone has been locked for a while and it's not being charged then OH notifications can be delayed for many minutes. If the phone is unlocked or being charged then OH notifications are instant. Unlocking the phone makes any delayed notifications appear.

In the notification settings for WhatsApp it has the "Use high priority notifications" option ticked. Not really sure what that means, but WhatsApp doesn't have any problem in immediately being able to show a notification. Perhaps this is related to high priority messages for Firebase Cloud Messaging which states they can wake the device from the doze state.

My phone is running Oxygen OS 9.0.3

Can you please make a screenshot of that settings UI? Can't find anything similar in the AOSP settings UI at the moment.
I doubt it's related to FCM high priority messages though, because we currently don't use that. We probably should do that, though, I guess. Relevant link: https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message ... obviously this needs to be changed in openhab-cloud though.

Firebase

The latest beta in using FCM instead of GCM and the latest server sends messages as high priority fcm messages. @digitaldan Did you deploy FCM on myopenhab.org?

The beta is still showing the same delayed behaviour.

Yes, because the openhab-cloud update wasn't deployed to myopenhab.org yet. There's nothing we can do on the client side.

Did the openhab-cloud update actually get deployed last night since I'm still seeing the same delayed behaviour?

Are there any updates regarding that problem yet? I experience the delayed notification behavior on my phone too.

Can you have a look at https://dontkillmyapp.com/ and if your device is listed there? Delayed notifications can be caused by non-standard battery savers.

Yes my device is listed on that website. I've disabled all the battery optimisations and have confirmed that the app is still running in the background and isn't being killed.

Do the messages from the server contain a notification payload or is it just a data message?

Do the messages from the server contain a notification payload or is it just a data message?

It's just a data message. With current openhab-cloud code deployed on myopenhab.org, it should be a high priority one.

I think there's a typo (prority instead of priority) in opehab-cloud and it's not being sent as high priority:

const firebaseOptions = {
delay_while_idle: false,
prority: 'high'
};

I think there's a typo (prority instead of priority) in opehab-cloud and it's not being sent as high priority

Ouch, that's correct. Can you create a PR against openhab-cloud for fixing this?

PR

Is there any schedule when this goes live or did the openHAB cloud already get updated?
I still receive delayed notifications if my device is not actively used.

Quickly wanted to report that I also have this issue. For my openHab app battery optimisation is disabled, so that shouldn't be a problem.

Android version: 9.0.0
Device model: Xiaomi Mi A1
Stock or customized ROM: Lineage OS 16.0 (official)
App version : 2.10.0
Build flavor : Play Store
Device language: German

@Andirs55 Can you have a look at https://dontkillmyapp.com/xiaomi?

Thanks for the hint, but i would say that does not apply to me since I do not run MIUI OS but LineageOS. I guess this comes closest to the AOSP devices and I checked that battery optimization is turned off for openHAB which is the only advice for these devices.

@digitaldan Where can I see the version of openhab-cloud on myopenhab.org?

I noticed that there is a similar problem in other repositories. Perhaps we can refer to this issue, and this oneto find more context about the bug (e.g. the Android version, or their steps to reproduce?).
Or maybe this can help us find the faulty lines and we can also refer to the fix and fix for the bug?

Besides, https://github.com/microg/android_packages_apps_GmsCore/issues/1093, https://github.com/AmazMod/AmazMod/issues/121, https://github.com/urbanairship/android-library/issues/52, https://github.com/katzer/cordova-plugin-local-notifications/issues/938 are also similar issues that may provide useful context.

As far as I know @MikeJMajor already submitted a PR with the fix and the PR is already merged too. I assume the only thing missing is a new release of the openhab cloud and the deployment to the myopenhab instance.

This seems to be fixed for me now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kubawolanin picture kubawolanin  路  13Comments

MikeJMajor picture MikeJMajor  路  3Comments

mueller-ma picture mueller-ma  路  13Comments

lolodomo picture lolodomo  路  10Comments

mueller-ma picture mueller-ma  路  3Comments