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

zmNinja push toasts not fully rendering image #813

Closed
pcross616 opened this issue Apr 23, 2019 · 17 comments
Closed

zmNinja push toasts not fully rendering image #813

pcross616 opened this issue Apr 23, 2019 · 17 comments

Comments

@pcross616
Copy link

Platform & OS Version
Android 8.0.0

The version of zmNinja you are reporting:
1.3.056

The version and OS of ZoneMinder you are using:
1.32.3, Ubuntu 18.06

Device details:
LG V30

What is the nature of your issue

Possible Bug / Question

Details

I am able to generate events and have them push to my phone via the event service via FCM as well as web socket. (Over the internet and local wifi). I have verified the token being registered as well as the payload submitted to FCM. I have verified the picture url being generated in the payload and is valid and functions after being submitted. But the push notification toast does not contain the image, the push notification space is accommodating the image size but nothing is rendered other than the text. I have tried disabling FCM and I have the same behavior. I have pulled down the app code to start debugging it further but I thought I would ask if anyone one has see this before. I will get my build environment up and try to test with different versions of android builds. I wonder if its an android 8.0 issue, since some of the push toast APIs did change in 8 i have read.

zmNinja Debug Logs

Example PUSH notification in App

Apr 21, 2019 12:23:13 PM INFO --------->Setting up global key handler...
Apr 21, 2019 12:23:13 PM DEBUG snapshot  supported in image.php
Apr 21, 2019 12:23:13 PM DEBUG Setting server version to:1.32.3
Apr 21, 2019 12:23:13 PM DEBUG getAPI version succeeded with 1.32.3
Apr 21, 2019 12:23:13 PM INFO Got API version: 1.32.3
Apr 21, 2019 12:23:13 PM INFO First invocation of TimeZone, asking server
Apr 21, 2019 12:23:13 PM INFO EventSever: Initializing Websocket with URL wss://zm.XXXX.com
Apr 21, 2019 12:23:13 PM DEBUG EventSever: Using native websockets...
Apr 21, 2019 12:23:13 PM DEBUG Transitioning state to: app.montage with param {"minimal":false,"isRefresh":false}
Apr 21, 2019 12:23:13 PM DEBUG NVR: Regenerating connkeys...
Apr 21, 2019 12:23:13 PM INFO getMonitors:Loading all monitors
Apr 21, 2019 12:23:13 PM INFO Checking value of ZM_MIN_STREAMING_PORT for the first time
Apr 21, 2019 12:23:14 PM DEBUG Timezone API response is:America/Los_Angeles
Apr 21, 2019 12:23:14 PM INFO ZM_EVENT_IMAGE_DIGITS is 5
Apr 21, 2019 12:23:14 PM DEBUG Setting multi-port to:false
Apr 21, 2019 12:23:14 PM INFO ZM_MIN_STREAMING_PORT not configured, disabling
Apr 21, 2019 12:23:14 PM DEBUG Real value of PRIVACY is:0
Apr 21, 2019 12:23:14 PM DEBUG ZMS Multiport reported: 0
Apr 21, 2019 12:23:14 PM DEBUG Monitor URL to fetch is:https://zm.XXXXXX.com/zm/api/monitors/index/Type !=:WebSite.json
Apr 21, 2019 12:23:14 PM DEBUG EventSever: WebSocket open called with:{"webSocketId":"a65da98c-7470-4cbc-bad4-fa9a65aa2463","code":101}
Apr 21, 2019 12:23:14 PM INFO EventSever: openHandshake: Websocket open, sending Auth
Apr 21, 2019 12:23:14 PM DEBUG EventSever: sendMessage: received->{"event":"auth","data":{"user":"admin",<password removed>,"monlist":"1,2","intlist":"0,0"}}
Apr 21, 2019 12:23:14 PM DEBUG EventServer: ok to send message
Apr 21, 2019 12:23:14 PM DEBUG EventSever: Initializing FCM push
Apr 21, 2019 12:23:14 PM INFO EventSever: Setting up push registration
Apr 21, 2019 12:23:14 PM DEBUG EventSever: Push Notification registration ID received: {"registrationId":"eT4zagHrHxs:APA91bEHpvW2nQZZyJ2D5o1dDUhgFfL4ZUAIbnhWf4CEHuui4w5ahuuSp6BsfKKx840v76PltCyI8FuhNKwkKB5y9tFjKssWHLT4tD_9-QqG9EO4hue0xttglsmZhHS4aldAqWQxqZGZ","registrationType":"FCM"}
Apr 21, 2019 12:23:14 PM INFO getMonitors:Loading all monitors
Apr 21, 2019 12:23:14 PM INFO sending Cached ZM_MIN_STREAMING_PORT 0
Apr 21, 2019 12:23:14 PM INFO EventSever: notification handler device ready
Apr 21, 2019 12:23:14 PM DEBUG EventSever: received push notification
Apr 21, 2019 12:23:14 PM DEBUG EventSever: PUSH NOTF >>> {"count":"0","title":"Front Door Alarm (395)","message":"Motion Doorway at 12:22 PM, 21-Apr","additionalData":{"summaryText":"alarmed image","priority":"1","picture":"https://zm.XXXXX.com/zm/index.php?view=image&eid=395&fid=alarm&width=600&username=zmevent&password=XXXXXXXX","myMessageId":"1","eid":"395","mid":"2","icon":"ic_stat_notification","style":"picture","dismissed":false,"coldstart":true,"foreground":false}}
Apr 21, 2019 12:23:14 PM DEBUG Notification Tapped
Apr 21, 2019 12:23:14 PM INFO EventSever: Push notification: Tapped Monitor taken as:2
Apr 21, 2019 12:23:14 PM DEBUG ZMS Multiport reported: 0
Apr 21, 2019 12:23:14 PM DEBUG Monitor URL to fetch is:https://zm.XXXX.com/zm/api/monitors/index/Type !=:WebSite.json
Apr 21, 2019 12:23:14 PM DEBUG Loading hidden/unhidden status for profile:
Apr 21, 2019 12:23:14 PM DEBUG Inside getMonitors, will also regen connkeys
Apr 21, 2019 12:23:14 PM DEBUG Now trying to get multi-server data, if present
Apr 21, 2019 12:23:14 PM INFO Monitor load was successful, loaded 2 monitors
Apr 21, 2019 12:23:14 PM DEBUG EventSever: Real-time event: {"status":"Success","event":"auth","reason":"","version":"3.5","type":""}
Apr 21, 2019 12:23:14 PM DEBUG EventSever: auth confirmation received, no pendingMessages in queue
Apr 21, 2019 12:23:14 PM DEBUG EventServer: broadcasting process-push
Apr 21, 2019 12:23:14 PM DEBUG >> PortalLoginCtrl: push handler
Apr 21, 2019 12:23:14 PM DEBUG Inside evaluateNotifications
Apr 21, 2019 12:23:14 PM DEBUG Came via push tap. onTapScreen=Montage
Apr 21, 2019 12:23:14 PM DEBUG Going to montage
Apr 21, 2019 12:23:14 PM DEBUG tapped Notification evaluation:["app.montage",{},{}]
Apr 21, 2019 12:23:14 PM DEBUG NVR: Regenerating connkeys...
Apr 21, 2019 12:23:14 PM INFO Returning pre-loaded list of 2 monitors
Apr 21, 2019 12:23:14 PM INFO sending Cached ZM_MIN_STREAMING_PORT 0
Apr 21, 2019 12:23:14 PM DEBUG Multiport=0


Zoneminder Logs (if applicable)

FCM payload example from logs

{
	"priority": "high",
	"to": "eT4zagHrHxs:APA91bEHpvW2nQZZyJ2D5o1dDUhgFfL4ZUAIbnhWf4CEHuui4w5ahuuSp6BsfKKx840v76PltCyI8FuhNKwkKB5y9tFjKssWHLT4tD_9-QqG9EO4hue0xttglsmZhHS4aldAqWQxqZGZ",
	"data": {
		"badge": 0,
		"picture": "https://zm.XXXXXX.com/zm/index.php?view=image&eid=136&fid=alarm&width=600&username=zmevent&password=XXXXXXXX",
		"mid": "2",
		"priority": 1,
		"message": "Forced Web at 11:14 PM, 20-Apr",
		"myMessageId": 1,
		"summaryText": "alarmed image",
		"icon": "ic_stat_notification",
		"eid": "136",
		"style": "picture",
		"title": "Front Door Alarm (136)"
	}
}

Image of push notification missing image example:
Screenshot_2019-04-23-12-56-01

Any help or suggestions to try would be helpful.
Thanks!

@welcome
Copy link

welcome bot commented Apr 23, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you follow the issue template or I may not respond.

@pliablepixels
Copy link
Member

Did you validate with an external picture? Last point of this section

@pcross616
Copy link
Author

If you mean does the image load via a browser externally yes it does.

I have verified the picture url being generated in the payload and is valid and functions after being submitted.

@pliablepixels
Copy link
Member

No, I mean did you try with a different image (public image). Please read the section I linked to (last bullet point)

@pcross616
Copy link
Author

pcross616 commented Apr 23, 2019

Yes, sorry miss read your question.. But I did, see below.

#picture_url = https://zm.XXXXX.com/zm/index.php?view=image&eid=EVENTID&fid=alarm&width=600&username=zmevent&password=XXXXXXX
picture_url = https://en.wikipedia.org/wiki/Pointy-haired_Boss#/media/File:Pointy-haired_Boss.png

@pliablepixels
Copy link
Member

pliablepixels commented Apr 23, 2019

That is not a valid URL. It takes you to the article about the pointy haired boss. Please try the image I linked to - not sure how transparent images will be treated.

@pcross616
Copy link
Author

@pliablepixels
Copy link
Member

Did you restart the ES? Config changes need reload

@pcross616
Copy link
Author

Yes - I am running it as a daemon and the process is restarting. (verified via new process ID)

zmpkg.pl stop
04/23/19 13:40:42.395051 zmpkg[22637].INF [main:57] [Command: stop]
04/23/19 13:40:42.396441 zmpkg[22637].INF [main:305] [Sanity checking States table...]
04/23/19 13:40:42.397713 zmpkg[22637].INF [main:97] [Command: stop]
mpkg.pl start
04/23/19 13:40:47.975425 zmpkg[22674].INF [main:57] [Command: start]
04/23/19 13:40:47.976769 zmpkg[22674].INF [main:305] [Sanity checking States table...]
04/23/19 13:40:47.977987 zmpkg[22674].INF [main:97] [Command: start]
04/23/19 13:40:49.408431 zmpkg[22674].INF [main:200] [Multi-server configuration detected. Starting up services for server 1]

@pcross616
Copy link
Author

I can send you an actual link to an image url on my server if you want offline.

@pliablepixels
Copy link
Member

pliablepixels commented Apr 23, 2019

  1. Stop the ES
  2. Run it in manual mode, with verbose = 1 (so we can see all debug logs) -see this part on how to
  3. make sure include_picture is yes
  4. Please post debug logs of ES (not ZM/zmNinja)

If we can't figure out, we may have to dive deeper to see what is going on - maybe inside the device, using adb logcat

I'm generally available in the ZM slack channel too (US ET)

@pliablepixels
Copy link
Member

I can send you an actual link to an image url on my server if you want offline.

Yep please do (pliablepixels gmail)

@pcross616
Copy link
Author

Sure, I will hop on ZM slack and send you the url offline. I might be on to something..

@pcross616
Copy link
Author

  1. Stop the ES
  2. Run it in manual mode, with verbose = 1 (so we can see all debug logs) -see this part on how to
  3. make sure include_picture is yes
  4. Please post debug logs of ES (not ZM/zmNinja)

If we can't figure out, we may have to dive deeper to see what is going on - maybe inside the device, using adb logcat

I'm generally available in the ZM slack channel too (US ET)

I was in the process of reenabling manual mode as you wrote that.. :)

@pcross616
Copy link
Author

ES log of Forced Alarm event with debugging on via console mode.

2019-04-23,14:27:25 ---------->Tick START<--------------
2019-04-23,14:27:25 After tick: TOTAL: 1, FCM+WEB: 0, FCM: 1, WEB: 0, MQTT:0, invalid WEB: 0, PENDING: 0
2019-04-23,14:27:25 Empty job queue
2019-04-23,14:27:25 New event 1196 reported for Front Door Forced Web

04/23/19 14:27:25.378096 zmeventnotification[25128].INF [main:533] [New event 1196 reported for Front Door Forced Web ]
2019-04-23,14:27:25 HOOK: 1196 Creating event object for Front Door, setting state to recording
2019-04-23,14:27:25 checkEvents() events found=1
2019-04-23,14:27:25 ---------->Tick END<--------------
2019-04-23,14:27:25 Forking process:25245 to handle 1 alarms
04/23/19 14:27:25.384282 zmeventnotification[25245].INF [main:533] [Forking process:25245 to handle 1 alarms]
2019-04-23,14:27:25 processAlarms: EID:1196 Monitor:Front Door (id):2 cause:Forced Web
04/23/19 14:27:25.385797 zmeventnotification[25245].INF [main:533] [processAlarms: EID:1196 Monitor:Front Door (id):2 cause:Forced Web ]
2019-04-23,14:27:25 Matching alarm to connection rules...
04/23/19 14:27:25.386706 zmeventnotification[25245].INF [main:533] [Matching alarm to connection rules...]
2019-04-23,14:27:25 Checking alarm rules for token ending in:...dAqWQxqZGZ
04/23/19 14:27:25.390043 zmeventnotification[25245].INF [main:533] [Checking alarm rules for token ending in:...dAqWQxqZGZ]
2019-04-23,14:27:25 Monitor 2 event: last time not found, so should send
04/23/19 14:27:25.395028 zmeventnotification[25245].INF [main:533] [Monitor 2 event: last time not found, so should send]
2019-04-23,14:27:25 shouldSendEventToConn returned true, so calling sendEvent
2019-04-23,14:27:25 Sending notification over FCM
04/23/19 14:27:25.397814 zmeventnotification[25245].INF [main:533] [Sending notification over FCM]
2019-04-23,14:27:25 Final JSON being sent is: {"priority":"high","data":{"priority":1,"mid":"2","style":"picture","title":"Front Door Alarm (1196)","badge":0,"myMessageId":1,"icon":"ic_stat_notification","picture":"https://zm.XXXXXX.com/zm/index.php?view=image&eid=1196&fid=alarm&width=600&username=zmevent&password=XXXXXXXXX","summaryText":"alarmed image","eid":"1196","message":"Forced Web  at 02:27 PM, 23-Apr"},"to":"eT4zagHrHxs:APA91bEHpvW2nQZZyJ2D5o1dDUhgFfL4ZUAIbnhWf4CEHuui4w5ahuuSp6BsfKKx840v76PltCyI8FuhNKwkKB5y9tFjKssWHLT4tD_9-QqG9EO4hue0xttglsmZhHS4aldAqWQxqZGZ"}
2019-04-23,14:27:26 FCM push message returned a 200 with body {"multicast_id":5926624131120322062,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1556054846333065%311426bef9fd7ecd"}]}
04/23/19 14:27:26.383431 zmeventnotification[25245].INF [main:533] [FCM push message returned a 200 with body {"multicast_id":5926624131120322062,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1556054846333065%311426bef9fd7ecd"}]}]
2019-04-23,14:27:26 Ending process:25245 to handle alarms
04/23/19 14:27:26.385184 zmeventnotification[25245].INF [main:533] [Ending process:25245 to handle alarms]
2019-04-23,14:27:30 ---------->Tick START<--------------
2019-04-23,14:27:30 After tick: TOTAL: 1, FCM+WEB: 0, FCM: 1, WEB: 0, MQTT:0, invalid WEB: 0, PENDING: 0
2019-04-23,14:27:30 PARENT GOT RAW TEXT-->badge--TYPE--1556054685.36966--SPLIT--1
2019-04-23,14:27:30 GOT JOB==> Update badge to:1 for id:1556054685.36966
2019-04-23,14:27:30 PARENT GOT RAW TEXT-->timestamp--TYPE--1556054685.36966--SPLIT--2--SPLIT--1556054845.39575
2019-04-23,14:27:30 GOT JOB==> Update last sent timestamp of monitor:2 to 1556054845.39575 for id:1556054685.36966
2019-04-23,14:27:30 Empty job queue
2019-04-23,14:27:30 Alarm 1196 for monitor:2 has ended
2019-04-23,14:27:30 HOOK: 1196 NOT writing hook to DB as hook text was empty
2019-04-23,14:27:30 checkEvents() events found=0
2019-04-23,14:27:30 ---------->Tick END<--------------

@pcross616
Copy link
Author

pcross616 commented Apr 23, 2019

Figured it out, the url parameters need to be URL safe; (in the case of the password, it needs to be URL encoded)
https://www.w3schools.com/tags/ref_urlencode.asp

To be clear my password I generated had a # and a = sign in it.

Thanks for all the support, keep up the great work.

@pliablepixels
Copy link
Member

Sounds good.

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

No branches or pull requests

2 participants