How to make an search app

How can i make a code ro search for stuff on an android home page ,my first thought was to take information from the android where the data for homescreen was stored but after some research i found out the data is stored on a mechanism similar to a app not stored as raw data , so i thought i could takes screen shots and implement them in my code however i don’t know how to do that and there was multiple errors in my code and i thought that i would also need a system or way to enter groups of apps and so on…

Repl link:

code sni