missing call reminder

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Micha
Posts: 46
Joined: 27 Dec 2017 23:04

missing call reminder

Post by Micha » 03 Jan 2018 21:22

Hello,

I want to make a flow that reminds me every five minutes if there is a missing call oder an unread sms. You can see my attempt in the attachment. But it doesn't go in the "yes" branch of the first condition. Perhaps com.android.phone is the wrong app name? Clearing the filter makes no difference.

I saw other solutions for my task here in the forum, but I want to understand why it's not working for me. And I only want one flow for it.

Micha
Attachments
flow_Missed_call_and_SMS_remimder_20180103_220208.xml
(3.29 KiB) Downloaded 881 times

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

Re: missing call reminder

Post by Desmanto » 04 Jan 2018 05:23

That flow will cause a huge battery drain. To implement it effective and efficiently, you will need at least 3 flows (2 flow if you combine flow 1 and 2). All of them are quite simple.

Flow 1 : Trigger Notification on Statusbar Displayed, use the ellipsis to choose your phone and messaging app. Action only one, enable flow 3

Flow 2 : Trigger Notification on Statusbar Removed, same package name as flow 1. Condition Notification on Statusbar Displayed (similar to trigger but this one check for state, not event), same package name. True : do nothing (no need to add element), False : disabe flow 3. The condition ensure if you have both missed call and sms, if you remove one of them, flow 3 won't get disabled directly, as there is still another notif.

Flow 3 : Periodic Timer, 5 Minute. Action only single vibration (or you can add sound notif also if you want, or maybe speech output).

Enable only flow 1 and 2. Flow 3 will be enabled/disabled by flow 1 and 2. If you let the periodic timer running with out disabling it, you will see a lot of unnecessary battery drain. Thus the vibrate flow should be enabled/disabled based on the current phone/sms notif.


If you don't know which is the package name that create the notif, you can just use same trigger Notification on Statusbar Displayed, match everything (single asterisk)
Package name : *
Then add a notication on screen, put the {package_name}, make the phone call/sms to this phone and check the package name. Or simply use debug dialog, which is faster if you can tes the call/sms directly. Other way is to manually create a new glovar type list (not string), example global_notif_log, use script to log the package name to the list.

Code: Select all

addElement(global_notif_log, "{app_name} {package_name}")
Let the flow run for a while, until you have received some missed call dan sms. Check the glovar later for the app/package name.
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
Micha
Posts: 46
Joined: 27 Dec 2017 23:04

Re: missing call reminder

Post by Micha » 04 Jan 2018 09:46

Thank you very much!

Now I have the three flows instead of only one. How can I see if a flow will cause a huge battery drain or not?

A trigger that checks the notifications has to run always, a timer with "every 5min" has to run only every 5 minutes, so I thought.

Micha

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

Re: missing call reminder

Post by Desmanto » 04 Jan 2018 11:51

I would rather have additional 2-3 flows rather than a single flow which drain my battery. Any optimization is welcomed, not matter how small. Trigger that check notification only get triggered when notification specific to the filter arrived. So even though it is active, it will never got triggered until it received the notification broadcast from the system. The same just like trigger shortcut also always active, but the flow never got triggered until we press the shortcut (and send the intent to the automagic). CMIIW.

Any trigger that use sensor or real time data, will consume more battery (there usually a warning for it). Other than those, a flow which get triggered too frequently without serving any purpose also considered inefficient.

In this case, if you use only Periodic timer, 5 minutes and enable the flow; the flow will get triggered 1440/5 = 288 times per day. Out of this 288 times, depends on you phone/sms activities, maybe only 5-20 served the purpose. Which make another 250+ triggered flow wasted.

This is caused by wrong event used as trigger. You want the flow to be triggered when there is missed call OR unread sms. So we should use those 2 as the trigger (but it actually only need one, trigger notification on both app). Continuing the logic, we actually should use sleep for 5 minutes and repeat again if the notification still exist after 5 minutes. Thus actually we only need single flow.

But this is not efficient. As when you use sleep action, the flow is still running. I don't know how automagic implement the sleep under the hood, but i consider it is still using CPU cycle to maintain the running flow, especially when the keep awake is checked. (thus preventing the CPU to go power save mode). If not, how can it detect the flow has finished? unchecking the keep awake can cause unpredicatable delay when the screen is off during longer sleep period. (thus not preferred) So I will consider any sleep longer than 1 minutes as inefficient. We are wasting CPU cycle (thus battery life) for nothing (only sleeping flow). Unless the sleep is needed somewhere for the logic (example, coupled with AEP Skip, to protect the flow from triggered again before the sleep finish)

To remove the sleep, we have to move the interval 5 minutes to somewhere else. Since we want to do it repeatly, Periodic Timer is the best choice. For one time interval, use Global Variable Date/Time (or you can use calendar event as well). Since the action of vibrate has been moved to other flow, we have to disable/enable the periodic timer flow from the main flow. That's why we have flow 1 and 2 to enable/disable it. While flow 3 will be dormant until got enabled by flow 1, repeat its interval and be dormant again when disabled by flow 2. This way, all interval timer by flow 3, will all served its purposed, not wasted anymore. Hence, effetive and more efficent than using only single flow.

If there are others find out the otherwise, I would like to know the testing result. I am using similar logic for most of my flows which need to deal with sleep longer than 1 or 5 minutes.
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
Micha
Posts: 46
Joined: 27 Dec 2017 23:04

Re: missing call reminder

Post by Micha » 04 Jan 2018 15:06

Thank you for your long explanation!

Micha

Post Reply