Launch Default Apps

Post your questions and help other users.

Moderator: Martin

Post Reply
Pepy
Posts: 39
Joined: 31 Oct 2018 10:53
Location: Canada

Launch Default Apps

Post by Pepy » 13 Jun 2019 20:56

Is there a way I can launch the assigned default apps? Specifically, I would like to open my default Phone app to go back to the calling screen after leaving the app during the middle of a call.
I would prefer doing it this way since I won't have to update the corresponding Launch App action as well every time I change the default app.
I'm guessing the way to achieve this would probably be to send a key combination using the Automagic keyboard but I don't think there is a key on keyboards dedicated to opening up the Phone app.
Newbie to device automation! Hope my post was helpful :D
Device Status: OnePlus 5T (Dumpling) running crDroid 5.x, rooted with Magisk.

anuraag
Posts: 224
Joined: 24 Jan 2015 02:06

Re: Launch Default Apps

Post by anuraag » 14 Jun 2019 02:15

Code: Select all

ctx=getContext();
tm=callJavaMethod(ctx, "android.content.Context", "getSystemService(java.lang.String)", "telecom");
defaultDialer=callJavaMethod(tm, "android.telecom.TelecomManager", "getDefaultDialerPackage()")
Use above code in a script action. defaultDialer will contain default dialer package name. Set Launch App Package Name to Variable defaultDialer.

Pepy
Posts: 39
Joined: 31 Oct 2018 10:53
Location: Canada

Re: Launch Default Apps

Post by Pepy » 14 Jun 2019 22:22

I ended up using a Notification on Statusbar Displayed condition to look for an "on-going call" notification and using one of it's buttons to toggle the speakerphone state, so the package name wasn't really necessary anymore.
Thanks for the code though, it will definitely prove to be useful in the future for launching default applications in general!
Newbie to device automation! Hope my post was helpful :D
Device Status: OnePlus 5T (Dumpling) running crDroid 5.x, rooted with Magisk.

Post Reply