Kill App not working

Post your questions and help other users.

Moderator: Martin

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 16 May 2020 00:48

No. This is what I'm trying to do, and after the third-party dialer is launched, the stock dialer (if it was launched) should be completely gone (not in recents, not reopened when backing out of the third-party dialer):
Dialer.png
Dialer.png (17.48 KiB) Viewed 16129 times
Or leave the stock dialer as the default phone app, so it's opened automatically when tapping the notification, and have a trigger so when it opens (since that's the only time it would happen) to launch the other dialer, again removing all traces of the stock dialer. In that case, the stock dialer would remove the notification and clear the missed calls count, but I'd still need the other path to deal with it if I just open the third-party dialer instead of tapping the notification. Either way should work equally well; the problem is that launching the stock dialer then immediately launching the third-party one doesn't work well, since the second dialer often doesn't get launched. And sometimes the stock dialer isn't properly "cleared," as backing out of the third-party dialer still sometimes goes back into it. Both of those problems exist regardless of the main flow setup.

User avatar
Hit
Posts: 91
Joined: 20 Jan 2020 11:31

Re: Kill App not working

Post by Hit » 16 May 2020 03:01

You still didn't answer all the question of mine especially how to clear an app from recent, by clicking or by swiping.

Another question is in your new Dialer app setting. had you changed the option "Phone app" to 'Yes'?

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 16 May 2020 03:42

Hit wrote:
16 May 2020 03:01
You still didn't answer all the question of mine especially how to clear an app from recent, by clicking or by swiping.
Either, but that's not the main problem. The main problem is that the stock dialer has to be launched, but I want it to launch and immediately be replaced by the dialer I actually want to use, but that dialer rarely even opens. As I said, my guess is it's just happening too quickly for the phone to keep up, and Android is too inept to simply execute the command and launch the app when it can, and instead just drops the ball.
Hit wrote:
16 May 2020 03:01
Another question is in your new Dialer app setting. had you changed the option "Phone app" to 'Yes'?
Yes, but apparently that's not enough for wonderful Android; they have to force you to use a specific app to do it.

User avatar
Hit
Posts: 91
Joined: 20 Jan 2020 11:31

Re: Kill App not working

Post by Hit » 16 May 2020 04:14

Try adding:
  • Control UI: back();
at right time.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 16 May 2020 04:44

Not sure when the right time would be, but using Control UI: home() added a significant delay, and back() in the same place results in the second dialer not launching.

It was informative, however, because each time I ran it (Launch stock dialer > back() > launch 2nd dialer > kill stock dialer), when I went back to Automagic it was on the main page (flows list). So the back() command is being issued after the stock dialer is triggered to launched but before it actually launches. Which basically proves what I was saying before: the stock dialer is called, but before it actually opens the second dialer is called, and instead of Android simply performing the actions in the order given, launching the first then second dialer, it simply fails to do the second action (opening the second dialer). I just don't see how it's possible to get it to work this way since Android isn't cooperating, so I appear to have no choice but to just use the launch of the first dialer as another trigger for the flow and use a trigger condition to launch the second dialer in that case. That works fine doing it that way, and I could have been done with this a while ago if I just gave up and did it that way, I just wanted to see if I could make it work the proper way.

Another way to do it, though it would require more processing, would be to set up a loop to check every 10-100ms to see if the dialer has launched, and once it has continue executing the flow to launch the second dialer. And if it were a large, complex flow, that might be preferable. But for this one being as small as it is, it's easier to just use a separate trigger, which both executes immediately instead of waiting for the next check in a loop and doesn't use processor time running the loop.

User avatar
Hit
Posts: 91
Joined: 20 Jan 2020 11:31

Re: Kill App not working

Post by Hit » 16 May 2020 06:36

I tried on my phone with Manual trigger:

open Phone app => open Recent => clear Phone app
=> open another Application

Nothing go wrong.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 16 May 2020 07:18

And when I do the same I see the recent apps flash very briefly before the dialer opens. The dialer just takes too long to launch to have another action immediately follow it that depends on the dialer actually being open. I don't know if my phone's just slower than yours or if the stock dialer on my phone is slower or what, but it doesn't work for me. And even if I were to get a new phone that was faster and it worked properly on that, I'd still be hesitant to use any of these methods since they're apparently very dependent on that, and I don't like to design things that may or may not work at any given time. It may work 99 times out of 100 on your phone but every now and then fail to work properly, and to me that's unsatisfactory.

I want to be clear, in case @Martin reads this, I blame Android, not Automagic. That said, it would be nice if Automagic had a way to work around the issue. For example, when launching an app with start activity, there's an option to wait for result. It seems this action and the launch app action could use an option to wait until the app launches before proceeding. Or maybe there's a way to improve the call to launch the apps so they don't get dropped by the OS (assuming that's actually what's happening).

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

Re: Kill App not working

Post by Desmanto » 16 May 2020 17:07

@vertigo : Takes a while to understand the problem (and I still not sure if I get it properly).

If you want the second dialer only launch after the main dialer close, use Trigger App Task Ended in another flow. This ensure the launch of the second dialer always after main dialer close. You can kill the main dialer afterward. Trigger App Task Started/Ended typically takes about 600 ms, should be considered quite responsive if the launching of your app already takes several seconds.
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.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Kill App not working

Post by vertigo » 16 May 2020 21:58

I don't want the second dialer to launch when the first one closes, I want it to launch when the first one launches. The only reason for launching the stock dialer is to reset and clear the missed calls notification, which third-party dialers can't do. So as soon as it's launched, I want it replaced by the second dialer, which is the one I actually want. The problem is that if I launch the first one, to deal with the notification, then immediately launch the second one, the second one doesn't actually get launched, because the command to launch it is executed while the first one is still opening. My point is that when Android receives the second launch command while still in the process of launching the first app, that command should be queued and the app should launch immediately after the first, but instead it seems to just be dropped by the OS. And since it doesn't work properly, I'm forced to use a less ideal solution, which is to set up another trigger to make the flow launch the second dialer whenever the first one is opened.

User avatar
Hit
Posts: 91
Joined: 20 Jan 2020 11:31

Re: Kill App not working

Post by Hit » 17 May 2020 00:24

You can try to open Phone app after closing the second one then close it

Post Reply