It is a little compicated, but it can be done, you must read , and search the net, I had done so installing shizuku and macrodroid, it is working fine.
You don't have to be root, I am NOT. I have done so using a quick setting tile, usind macrodroid with the help of shizuku
You must start shizuku...