2

I want to remove all the icons on the desktop, (and also in the bottom bar) and place new ones via ADB. My script already removes all the apps, but icons/shortcuts remanin there!

Is there any command to do this? Or maybe a xml file or something that I can edit?

Note: I have root access.

2
  • 3
    I'm pretty sure that any answer to removing home screen icons is going to be very dependant on what launcher you're running. Do you know what launcher you're running? If not, what make/model/OS version of phone are you looking it? Are you using the default launcher that came with it, or have you loaded another one on?
    – GAThrawn
    Commented Apr 4, 2014 at 14:37
  • It is the default android launcher ... My android version is 4.2.2 Commented Apr 4, 2014 at 14:52

2 Answers 2

1

The default launcher in my stock Android 4.2.1 and CM12 contains those home screen shortcuts in a table named favorites inside launcher.db. If that's your case then all you have to do is flush the content from that table, restart the launcher and the stuff would be gone for good.

A general query would be:

adb shell su -c 'sqlite3 /data/data/<YOURLAUNCHER>/databases/<.DB_FILE> "DELETE from <TABLE>"'

(Download sqlite3 if it's not present in the system.)

For my stock launcher in Android 4.2.1, the query would be:

adb shell su -c 'sqlite3 /data/data/com.android.launcher/databases/launcher.db "DELETE from favorites"'

However, you first have to analyze which .db file, and which table in particular, actually holds the relevant stuff.

  • For that you can use SQLite Editor or aSQLite Manager to locate the relevant database and table. Or, you may adb pull all the launcher's database files and open them in an sqlite program on PC like DB Browser for SQLite to find the correct table.

  • For a command-line way, you can use this command to list all the tables in a supplied database:

    adb shell su -c 'sqlite3 /data/data/<YOURLAUNCHER>/databases/<A_DB_FILE>  ".tables"'
    

    In order to create shortcuts you first need to know their structure in the table. Use .schema then SELECT * <PARAMS> to see the content. You can take help (in making a query) from this resource.

    However, I would recommend choosing GUI over CLI to see the information about shortcuts. Also, always take backup before tweaking such stuff.

Once you're done flushing the table's content, do:

adb shell su -c 'am force-stop <PKG_NAME>'

E.g.:

 adb shell su -c 'am force-stop com.android.launcher'

or

adb shell su -c 'am force-stop com/cyanogendmod.trebuchet'
0

Try this:

adb shell pm clear com.android.launcher

(i think it's the unique name of the launcher in 4.4.2, change it if I'm wrong)

1
  • I'm using an x86_64 Android image that comes with the Android 24 SDK, and the package name is com.android.launcher3.
    – user99123
    Commented Sep 18, 2017 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .