Re: Quick Video Recorder, not working when device locked

936 views
Skip to first unread message
Message has been deleted

narf...@gmail.com

unread,
Jul 7, 2021, 11:38:16 AM7/7/21
to Automate
You can grab the "unlock" subroutine from this flow. If it can't unlock your phone with the API, it'll use a UI workaround. (You might notice an error in the log the first time it runs when it figures that out.) You'll also need to have set up Smart Lock to let the flow unlock your phone:

On Wednesday, July 7, 2021 at 5:04:20 AM UTC-7 Ollie wrote:
I have a simple flow which goes

SMS received
Start Quick Video Recorder service
SMS received
Stop Quick Video Recorder service
Loop to start

This works perfectly but only when the screen is on. When the screen is locked, the service doesn't start even though the flow log shows it carries out each step. I've disabled every conceivable battery/optimization feature on my Samsung (using Android 11), so I believe this has to do with the restriction on starting services in the background (since Android 9).

Is there a way to overcome this programatically in Automate? I tried having it launch the main Quick Video Recorder service prior to the service, but again, that worked only when the screen was unlocked.

(I know Automate has its own video record feature but QWR uses Camera2, I'd like to stick with that if possible)

Thank you everyone

Henrik "The Developer" Lindqvist

unread,
Jul 7, 2021, 2:36:14 PM7/7/21
to Automate
In the Service start block, try setting Flags to 0x10000000, this will start the service as "foreground", but the service has to support it, i.e. usually showing a "running" notification.
Message has been deleted
Message has been deleted

Henrik "The Developer" Lindqvist

unread,
Jul 8, 2021, 2:55:21 PM7/8/21
to Automate
Odd, as the device being locked doesn't affect permissions requirements. Are you sure the service can be started while the device is unlocked?

Android requires that an service running in the "foreground" show the notification, if it doesn't the system will kill it after a few seconds.

On Thursday, July 8, 2021 at 1:20:13 PM UTC+2 Ollie wrote:
Thank you both. To use the unlock subroutine, would I copy essentially everything on the right side of the flow diagram?

Henrik, I tried your suggestion and get this message: "java.lang.SecurityException: Not allowed to start service Intent (....) without permission not exported from uid ....

The app in question does have a running notification. Is there any way for Android security to register this?

Henrik "The Developer" Lindqvist

unread,
Jul 8, 2021, 2:57:02 PM7/8/21
to Automate
Launching the app using the App start block, or starting its service using the Service start block?

Samsung device?

On Thursday, July 8, 2021 at 5:40:18 PM UTC+2 Ollie wrote:
I should add that I've had a go with using the inbuilt Video Record function and it works great, no problems launching while locked, so thank you very much for such a robust implementation, Henrik.

In an earlier post I found, you (or one of your colleagues) mentioned that you intend to build Camera2 block. Is this still on the agenda? My only problem with the original camera API is it won't let you select high resolution 4:3 formats.

Thanks again for all you've done, Automate is definitely the most impressive app I've used in a long time, and so much more intuitive than its competition.
On Thursday, 8 July 2021 at 12:20:13 UTC+1 Ollie wrote:
Thank you both. To use the unlock subroutine, would I copy essentially everything on the right side of the flow diagram?

Henrik, I tried your suggestion and get this message: "java.lang.SecurityException: Not allowed to start service Intent (....) without permission not exported from uid ....

The app in question does have a running notification. Is there any way for Android security to register this?

On Wednesday, 7 July 2021 at 19:36:14 UTC+1 Henrik "The Developer" Lindqvist wrote:
Message has been deleted
Message has been deleted

Henrik "The Developer" Lindqvist

unread,
Jul 9, 2021, 3:19:44 PM7/9/21
to Automate
I don't think it's an Android 9+ only restriction, an Activity has to enable being shown atop the lock screen.
  1. Maximum duration could probably be use as such, it it's not really made for it since the video wont be continuous, i.e. frames will be lost. Other apps with such a feature  has likely implemented it themself, and not relying to that Android feature.
  2. Yes.

On Friday, July 9, 2021 at 12:06:13 PM UTC+2 Ollie wrote:
You're correct, sorry, it turns out I was launching an 'activity class' through the 'App start' block, not a service. I assume the Android 9 restrictions prevent as activity from being launched while in lock screen.

Before I stop pestering you, can I please ask a couple of quick follow up questions?

1) In some video recording apps, there is the option of breaking a recording into separate files of a maximum size or length, so that a new file is generated every 5 minutes. So for example, a 30 minute recording would be split into 6x5m files, each starting after the last reaches the 5m point. Is this achievable using the 'maximum duration' function in the Video Record block, or must that always end the recording block completely?

2) Is a Camera2 block still planned for Automate?

Thank you!
Reply all
Reply to author
Forward
Message has been deleted
0 new messages