Emailing a photo on failed unlocks... Works a bit too well...

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
User avatar
Scott
Posts: 24
Joined: 12 Dec 2015 00:09

Emailing a photo on failed unlocks... Works a bit too well...

Post by Scott » 05 Dec 2019 20:14

I have a flow that takes a photo and emails it whenever an attempt to unlock the phone has failed. The problem is that this happens several times a day when I accidentally enter the wrong bloody pattern, and then I have to go in and delete the photo and email. The worst part is having to look at my hideous damned face.

I'd like to have the flow take the photo, then WAIT and:

1. Send the photo as normal if the phone has not been unlocked within a certain period of time; or
2. Delete the photo and of course NOT send an email if the phone has been unlocked within aforementioned period of time.

I want it to continue taking a photo on the first failed unlock... I don't want it waiting for any retries... I just don't want it to be emailed straight away.

How can I go about this?
Samsung Galaxy S9+ (unrooted and cannot/will not root), Android 9.0
Latest stable Automagic version, always

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Emailing a photo on failed unlocks... Works a bit too well...

Post by Desmanto » 06 Dec 2019 10:51

Retain your flow structure until taking photo. Then split the sending email section into new flow. The new buffer flow act as the timer and unlock check.

Main Flow
-----
- Take picture
- Enable buffer flow

Buffer Flow
Trigger 1 : Periodic timer : 5 minutes (change to your desired time)
Trigger 2 : User Present
Action : disable buffer flow (disable itself after execution)
Expression : trigger == "User present"
True : Delete the photo and Show toast message that the photo not sent anymore
False : Send the photo via email

So everytime main flow triggered by the fail unlock event, it will take picture and enable the buffer flow. The buffer flow wait as long as the timer you specified. If during this time interval, you successfully unlock the phone, the buffer flow continue with true and delete the photo. But if no successful unlock, continue with false and send the photo. Both branch will disable the flow so it only activated after the unsuccessful unlock.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Scott
Posts: 24
Joined: 12 Dec 2015 00:09

Re: Emailing a photo on failed unlocks... Works a bit too well...

Post by Scott » 06 Dec 2019 12:53

Thank you--"User present" is the main piece I couldn't recall. I have not worked with flows much lately.

Thanks!
Samsung Galaxy S9+ (unrooted and cannot/will not root), Android 9.0
Latest stable Automagic version, always

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Emailing a photo on failed unlocks... Works a bit too well...

Post by Wibbly » 09 Dec 2019 09:47

.. or, simply ...

Leave your main flow as it was but insert a sleep action before the photo is actually sent (to give you time to enter the code).

Then in a second flow use trigger "user present" with an action "stop flows" to stop the main flow

.. or even more simply ..

In your main flow use the trigger "Login attempt" with the parameter 'On the Nth failed attempt'. This is what I use to deal with fat fingers ;-) I agree this doesn't meet your requirement "I want it to continue taking a photo on the first failed unlock... I don't want it waiting for any retries..." I have it set to 2, on the basis that anyone who doesn't know the unlok code will almost certainly give it a second attempt.

Post Reply