Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Android only) Notifications don't arrive when a cellphone is locked #726

Closed
ifurman68 opened this issue Oct 22, 2018 · 5 comments
Closed
Labels

Comments

@ifurman68
Copy link

Platform & OS Version

Android 9.0 Pie

The version of zmNinja you are reporting:

1.3.021

The version of ZoneMinder you are using:

1.32.2

Device details:

Google Pixel XL

What is the nature of your issue

Bug

Details

Push notifications don't arrive if the phone has been locked for some time (usually, more than 10 min). The notifications DO arrive immediately as the phone gets unlocked.
There is no issues with notifications of all other applications. Disabling battery optimization for zmNinja does not help as well as turning off Adaptive Battery feature (system wide).

Thanks!

@pliablepixels
Copy link
Member

I'm not really sure how to replicate this. My android device (Moto E, Android 7) doesn't show this behavior at all. If you can install adb on your system and do adb logcat | grep PushPlugin while the phone is connected via USB I may get some tips on what the phone is doing when a message is pushed

@pliablepixels
Copy link
Member

Ok, I think I may have a solution

  1. Stop the server
  2. Edit it, around line 842, add priority=>1 to the message like so:
 my $android_message = {
            to=>$obj->{token},
            data=> {
                title=>$title,
                message=>$header." at ".$now,
                style=>"inbox",
                myMessageId=> $notId,
                icon=>"ic_stat_notification",
                mid=>$mid,
                eid=>$eid,
                badge=>$obj->{badge},
                priority=>1
            }    
        };   

@pliablepixels pliablepixels changed the title Notifications don't arrive when a cellphone is locked (Android only) Notifications don't arrive when a cellphone is locked Oct 22, 2018
@ifurman68
Copy link
Author

The issue happens only when the cellphone is running on battery. If connected to an external power, all notifications arrive successfully

pliablepixels referenced this issue in ZoneMinder/zmeventnotification Oct 22, 2018
@pliablepixels
Copy link
Member

closing as OP confirmed latest fix above resolves this issue

@ifurman68
Copy link
Author

Just to clarify. This is what fixed this issue

my $android_message = {
to=>$obj->{token},
priority=>'high',
data=> {
title=>$title,
message=>$header." at ".$now,
style=>"inbox",
myMessageId=> $notId,
icon=>"ic_stat_notification",
mid=>$mid,
eid=>$eid,
badge=>$obj->{badge},
priority=>1
}
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants