How to move app icons using script/commands on android?

59 Views Asked by At

I want to be able to move app icons to specific positions on android 9. The reason for this is because I was running low on storage (my phone has only 16GB of storage), and I formatted part of the microSD card as internal storage. This did help but also introduced a new problem - since the SD card is loaded a few seconds after the original internal storage, each reboot completely messes up all icons, sending them to new pages as if they are freshly installed apps. And each time I have to spend 5 minutes fixing them. It would be nice to have a script that would automatically set them to specific positions.

I really have no idea how to do it nor I was able to find any soultion on the web. My phone is rooted and I can connect it to pc and send adb commands, so maybe it's possible?

1

There are 1 best solutions below

2
Diego Torres Milano On

You could do something like this using AndroidViewClient/culebra, however that you could does not mean you should though

enter image description here

#! /usr/bin/env python3

from com.dtmilano.android.viewclient import ViewClient

helper = ViewClient.view_client_helper()
oid = helper.ui_device.find_object(ui_selector="desc@YouTube").oid
t, l, r, b = helper.ui_object.get_bounds(oid=oid)
s_x = int(l + (r - l)/2)
s_y = int(t + (b - t)/2)
e_x = 300
e_y = 700
helper.ui_device.drag(s_x, s_y, e_x, e_y, 50)