suborb / philips_android_tv

Tools to control Philips 2016 Android TVs
GNU General Public License v2.0
121 stars 61 forks source link

Start apps #5

Open Hjord opened 6 years ago

Hjord commented 6 years ago

Is it possible to start installed apps with this?

nstrelow commented 6 years ago

It is possible judging from the Android TV remote app. GET activities/current returns {'component': {'className': 'com.google.android.apps.youtube.tv.cobalt.activity.ShellActivity', 'packageName': 'com.google.android.youtube.tv'}}

POST activities/launch That payload needs to be send to the TV. The TV should then execute the following code: intent.setComponent(new ComponentName(pkgName, classPathToActivity) So exactly the same thing the get is returning.

But I get a Bad Request 400, when posting it like this.

SagosHiron commented 6 years ago

Anyone got any luck running apps remotely?

nstrelow commented 6 years ago

Any luck @fliphess ? Tried also MITM the hell out of the Android app, but I just can't get it to work

SagosHiron commented 6 years ago

I was thinking about deploying some kind of web service onto TV that would run those intents. Over HTTP.

kipe commented 6 years ago

Hey, I managed to figure this out, you need to send the whole intent to the endpoint.

To fetch all the available applications, do a GET applications request. There the interesting part is intent. Once that is sent to POST applications/launch, the application actually launches.

For example, the application for Finnish channel MTV is presented like this in the applications endpoint (prettified for your pleasure):

{
    "id": "fi.mtvkatsomo.androidtv.MainActivity-fi.mtvkatsomo",
    "type": "app",
    "intent": {
        "action": "empty",
        "component": {
            "className": "fi.mtvkatsomo.androidtv.MainActivity",
            "packageName": "fi.mtvkatsomo"
        }
    },
    "order": 0,
    "label": "MTV Katsomo"
}

To change to Katsomo app, POST request must be done to the applications/launch -endpoint with content

{
    "intent": {
        "action": "empty",
        "component": {
            "className": "fi.mtvkatsomo.androidtv.MainActivity",
            "packageName": "fi.mtvkatsomo"
        }
    }
}
nstrelow commented 6 years ago

Amazing! Thanks so much :grin:

nstrelow commented 5 years ago

Started playing around with this again Actually it is "activities/launch" endpoint to start the app (at least on 43pus6401) with the payload you shared 💯

kipe commented 5 years ago

Oh, sorry. That was a typo in my previous message.