I have an automation that sends us notifications on our Android apps when a camera detects someone outside, with a picture from the camera that triggered the alert :
This works mostly well, except sometimes the image shown in the notification doesn’t actually show anyone. From the timestamp in the snapshot I suspect that /api/camera_proxy/ doesn’t take the snapshot when the notification is generated, but only takes it when the phone tries to load the picture. So if the phone is slow, disconnected or off when the notification is generated, it’ll load it minutes or hours later and get a completely unrelated picture.
Is that correct ? Is there an easy way to have this take the picture when the notification triggers, regardless of the state of the phone ?
I could save a picture to disk and send that over but I suppose I’m hoping there’s an easier way, this /api/camera_proxy thing would be so handy if it took the snapshot right away.
Yes it seems to only send the picture once the phone is connected, its something i have been trying to figure out as well, its really noticeable when there is several notifications when i get off a flight, all have the same image.
i have been thinking of using the service “Camera: take snapshot” to take the image instantly and saving with a unique filename, then using that filename in the image being sent in the notification. just being mindful that it needs to be accessable with the folder in allowlist_external_dirs. and im not exactly sure how the app handles the authentication with the images not from the camera proxy.
the other thing is images being cropped… but thats a separate issue! would be nice to pad the image at the same time though so when android crops to a 2:1 ratio the whole image is still visable
I haven’t noticed any cropping myself, but that’s interesting, I’ll keep an eye out for it !
Yes, saving it to disk is my backup plan. Shouldn’t be an issue with auth, in my experience it just works but dealing with deleting files when the notification is dismissed is a bit of a pain that I’d like to avoid if at all possible !
Camera proxy API is like show me a picture from the camera “now”, hence it being an API. Where "now’ is when the device received the notification. What most people do is take a snapshot and just use that.