Quick Tasker tip: Control which app is the default for an action (root only)

Screenshot_2013-07-02-14-13-45Some features of Android are impossible to control even with root, for what Google tends to call security purposes. Controlling which app should be the default app for an action (like clicking the home button or opening a URL) is one of those, and it can get a bit annoying when an OS that’s infamous for having security issues out of the box starts dictating what the power user part of its user base can and cannot do. Luckily, using Tasker, there is a way you can switch which app is the default for an action, using a clever trick.

Today’s quick Tasker tip is based off a very useful post on Reddit from last year, and all credit should go to its creator, laharah.

The way default actions work in Android is that whenever you only have one app that can perform an action, it will automatically use that app, but if there are more than one app, it will ask the user what to do. There is no way that I’m aware of to set this without actual user input (let me know if there is one), which leaves us with one option: disabling apps to make the system think there’s only one app that can perform an action. By freezing all the apps that can perform an action except one, only that final one will remain visible to the system, and it will use that one without asking. By unfreezing the frozen apps and freezing the other app, you can switch which app is visible to the system, and hence control which app is being used for an action.

This method requires root, and there’s no getting around that. On top of that, you won’t be able to use the apps that are frozen without unfreezing them, which can be a problem in some cases.

To actually do this, you need the Secure Settings plug-in, and you need to make sure it has root privileges. There is a Secure Settings action that you can then access, and one of the options in the configuration for it is  called Package State. This option will ask you to select an app, and then give you three options: Enabled, Disabled, and Toggle.

What you need to do is use this action to disable all the available apps for an action except one, using a task that consists of multiple Secure Settings actions that deal with each app. If you for instance want to use this to switch between Apex launcher and ssLauncer, you would need to enabled one when you disable the other to switch.

This is the very definition of a workaround, so there might be unforeseen issues with certain devices, ROMs, apps, etc. Still, in my experience, Android and the apps themselves handle being frozen and unfrozen with ease, and all this does is give Tasker the ability to do that.

As for why you would want to do it, well, I already mentioned launchers. Want a different home screen for work than for home? No problem, just use two different launchers and switch them using profiles for work and home! Want to use a specific PDF reader at the office and another one for reading at home? Go ahead!

I wasn’t aware of this trick until I discovered it on Reddit a while back, and I have to say I love it. I’m not a fan of Google dictating what I can and cannot do with my rooted phone, and I love any trick that gets me around those restrictions.

tasker banner - for some reason we don't have an alt tag here

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Andreas Ødegård

Andreas Ødegård is more interested in aftermarket (and user created) software and hardware than chasing the latest gadgets. His day job as a teacher keeps him interested in education tech and takes up most of his time.

Avatar of Andreas Ødegård

2 thoughts on “Quick Tasker tip: Control which app is the default for an action (root only)

  • Not exactly sure how it is on Android, but on modern Linux systems, it’s just a matter of modifying the mimeapps.list, which can be done with a simple text editor.

    From what I found on Google, this is the file in question: /data/system/users/0/package-restrictions.xml (0=userid of the current user, may differ).

    Root is needed to modify it, can’t test it yet, but will have a look.

  • Interesting. There have been times where I have wanted to dictate what app is the default based on more specific scenarios and I hope that I can accomplish it this way.

    The specific instance I had in mind was using Floating Browser Flux for links from Gmail/SMS. My friends often exchange cat gifs/funny pics/etc via these methods and only require a cursory glance. That said, Floating browser is much too limited to be my main browser.

    Does anyone have any other ideas?


Leave a Reply

Your email address will not be published. Required fields are marked *