Is it possible to make an app like the media controller app that WearOS comes with yourself?
Im asking because I want to design my own watch face that has media controls on it. There is a surprising lack of online documentation and people with this same question about this, which makes me think this is impossible to do.
Ive seen some watch faces that do this, such as the default face for the Wacth4 Classic from Samsung, but thats a system installed app so ofcourse it has moer permissions.
I have tried to use androidx mediaRouter but i keep getting a "There is no current session" error on the only available route when trying to use any command from the RemotePlaybackClient, which would indicate its controlling the media from the watch itself and not the phone.
Is there any possibility to do this without a companion app or is this restricted to system apps only?
CodePudding user response:
No, it's not possible without a companion app.
There is not a public API for this, so only the system can enable this currently. But there are a few ways to implement it, mostly with a companion app which means the wear and mobile apps share the same package and signature. The most obvious way is to use the Wear DataLayer, specifically the MessageClient and DataClient to send commands between the paired apps that you control.
If you implemented a paired app on Mobile that uses special notification permissions, then it could control the sessions for other apps on the mobile on your behalf. Essentially doing the same as the MCT app does.
Media Remote control is something we are considering implementing in https://github.com/google/horologist for Wear Media Apps. But not for controlling sessions for other apps.