Launch Default Apps

Post your questions and help other users.

Moderator: Martin

Post Reply
Pepy
Posts: 75
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, useful or informative :D
Device: OnePlus 5T (Dumpling) running crDroid 5.x, rooted via Magisk 8-)

anuraag
Posts: 270
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: 75
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 toggle the speakerphone via an action button on an "on-going call" notification so the package name wasn't necessary anymore.
Thanks for the code though, it will definitely prove to be useful in the future!
Newbie to device automation! Hope my post was helpful, useful or informative :D
Device: OnePlus 5T (Dumpling) running crDroid 5.x, rooted via Magisk 8-)

Post Reply