In my opinion the whole notion of coupling the UI to the API was a step in the wrong direction. It makes it effectively impossible to compose apps the way you can compose command line utils with piping. Apps should be designed as client/server by default, and then you could always leverage the service API for the app any way you want, slap a custom UI, use it in automation scripts, etc. It’s just way more flexible that way.
The “struggle” is because Apple and Google refuse to do so as they built the platform to give themselves priority.
One can trivially do so on a Linux phone, e.g. PinePhone with PostMarketOS.
Source: I did it. Plenty of others do through the usual ways, e.g. pipe in the console but also with things like https://sxmo.org/docs/user/sxmo.7.html#HOOKS
In my opinion the whole notion of coupling the UI to the API was a step in the wrong direction. It makes it effectively impossible to compose apps the way you can compose command line utils with piping. Apps should be designed as client/server by default, and then you could always leverage the service API for the app any way you want, slap a custom UI, use it in automation scripts, etc. It’s just way more flexible that way.