2

Not sure if that's the place to ask this (maybe stackOverflow is better), but here we go:

Background

There are plenty of possible commands that you can perform by using ADB. I use many of them on my tiny app-manager alternative app.

The problem

I can't find a way to clears the default of a specified app.

I mean the clearing of the app as the default one to handle some actions, as being shown on the "app-info" (AKA "manage-app") screen.

What I've tried

In the past, it seems that it was possible by having a certain permission and some API commands, but it's no longer possible.

A possible workaround would be to disable&enable the app, but that causes weird things to happen on some other apps, for example launchers will remove the app's icon when it becomes disabled.

I've also noticed a file on :

/data/system/users/0/package-restrictions.xml

that has some xml tags that include apps, and when I clear-default of an app, it is gone from this file. I don't think that playing with this file would be a good workaround, as things can change over time, and I don't even know if changing it will do anything, especially not in the current session.

The question

If there is no such a command?

Is there any way to do it using root?

  • Since you're a developer, and happy to investigate the internals, why not take a look at the source of the Settings app, and see what the real "Clear defaults" button does? – Dan Hulme Aug 27 '14 at 16:36
  • @DanHulme I tried, and for some reason I only found the interface of the functions (meaning just signature and name) and not what they really do. Also, even if I do succeed, I'm not sure I will be able to find a way that will work well on all Android devices, and if someone else has a better way to handle it, I want to know about it. I will try to look further. – android developer Aug 27 '14 at 18:14
  • I believe the code you found was similar like this, and I can confirm that there is no implementation code of those, only the interface, which I'm afraid that the answer is: no, it's impossible to do that using ADB. – Andrew T. May 5 '15 at 8:39
  • @AndrewT. That's too bad. even with root, I can't find how to do it. – android developer May 5 '15 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.