Not Sure How to use Plugin

I have a plugin that was created by Josep Fargas and I am trying to launch an app on my sony TV using the App. I have edited the portion of the PartnerAppMappings variable that match the Apps my TV currently has configured. I am unsure how the function sets the parameter values that the function issues to the SonyTV. When I configure a button to carry out the action I set the Data action to plugin.LaunchApp and set the value to Emby which is the app I want the TV to launch but do not get the expected result (nothing seems to happen) but if I carry out any other action it behaves as expected.
SonyTV.plugin (13.0 KB) is the plugin being used. I think my problem is that I am not configuring the data action properly?

Hi Bruce,
have you customized the plugin code? The posted plugin code does not contain the Emby app URI.

missing part in the plugin code (last entry):

var partnerappiconpath = "http://" + hostname + "/DIAL/icon/";
var PartnerAppMappings = [
    {
        "title": "Spotify",
        "uri": "com.sony.dtv.com.spotify.tv.android.com.spotify.tv.android.SpotifyTVActivity",
        "icon": partnerappiconpath + "com.sony.dtv.com.spotify.tv.android.com.spotify.tv.android.SpotifyTVActivity.png"
    }, {
        "title": "Digital Concert Hall",
        "uri": "com.sony.dtv.com.novoda.dch.com.digitalconcerthall.tv.TvMainActivity",
        "icon": partnerappiconpath + "com.sony.dtv.com.novoda.dch.com.digitalconcerthall.tv.TvMainActivity.png"
    }, {
        "title": "Prime Video",
        "uri": "com.sony.dtv.com.amazon.amazonvideo.livingroom.com.amazon.ignition.IgnitionActivity",
        "icon": partnerappiconpath + "com.sony.dtv.com.amazon.amazonvideo.livingroom.com.amazon.ignition.IgnitionActivity.png"
    }, {
        "title": "TED",
        "uri": "com.sony.dtv.com.ted.android.tv.com.ted.android.tv.view.MainActivity",
        "icon": partnerappiconpath + "com.sony.dtv.com.ted.android.tv.com.ted.android.tv.view.MainActivity.png"
    }, {
        "title": "ARTE",
        "uri": "com.sony.dtv.tv.arte.plus7.tv.arte.plus7.leanback.MainActivity",
        "icon": partnerappiconpath + "com.sony.dtv.tv.arte.plus7.tv.arte.plus7.leanback.MainActivity.png"
    }, {
        "title": "TV3",
        "uri": "com.sony.dtv.cat.ccma.androidtv.tv3.cat.ccma.androidtv.views.activities.GatewayActivity",
        "icon": partnerappiconpath + "com.sony.dtv.cat.ccma.androidtv.tv3.cat.ccma.androidtv.views.activities.GatewayActivity.png"
    }, {
        "title": "RTVE alacarta",
        "uri": "com.sony.dtv.com.rtve.androidtv.com.rtve.androidtv.Screen.SplashScreen",
        "icon": partnerappiconpath + "com.sony.dtv.com.rtve.androidtv.com.rtve.androidtv.Screen.SplashScreen.png"
    }, {
        "title": "DW for Smart TV",
        "uri": "com.sony.dtv.ceb-5226",
        "icon": "http://static.internet.sony.tv/bivl-ww/static/service/icons/service_551/x180.png"
    }, {
        "title": "Meteonews TV",
        "uri": "com.sony.dtv.ceb-5216",
        "icon": "http://static.internet.sony.tv/bivl-ww/static/service/icons/service_382/x180.png"
    }, {
        "title": "Emby",
        "uri": "com.sony.dtv.emby.app.com.emby.app.MainActivity", // Add the correct URI for the Emby app here
        "icon": partnerappiconpath + "com.sony.dtv.emby.app.com.emby.app.MainActivity.png" // Path to the icon of the Emby app
    }
]

Sorry, I sent the original Josep Vargas plugin. Here is the plugin after I edited and put app info returned by Sony API getApplicationList.
Bravia.plugin (12.5 KB)

I also need to clarify I have not much experience with Java and I am having a hard time understanding how the function gets parameters passed into it and responses are handled. I have C programming experience and a few older languages but I am new to OOP so it is a learning process for me as well.

Have you checked that the up address is reachable and port open?

Yes I can communicate with the TV. The plugin operates all the mediaCommandMappings, when you set the data action to the command and the inputSourceMappings also work but the launchApp data actions do not seem to do anything. I believe I need to set the binding for the button to the plugin and set the data action to launchApp and the value = to the App I want to launch but nothing seems to happen.

One important thing is that the app name is case sensitive. It must be written exactly as it is displayed on your TV. For example, if the app “EMBY” is written, this must also be written in the value.

I am still having trouble understanding how the script determines the “uri” when only the “title” is passed to the “LaunchApp” case in the onChangeRequest function. I see how the object is populated in the var declaration but can’t see how the parnterAppMappings.title can provide the partnerAppMappings.uri? Is this something to do with object inheritances or something else I don’t understand.

From the designer, create a button. Then add an EventTrigger, then add a DataAction. In the DataAction, add a binding with the name of your bravia plugin.LaunchApp. Then put the uri for the app you want to load in the Value box. Let me know if you have any more questions.

Actually, maybe don’t try the above method. I tested it on my Sony TV and it loaded the app so I posted the above solution. But since then, the tv keeps randomly popping up the Amazon Prime app over and over. I had to change the PSK to get it to stop. Not sure what went wrong. So try at your own risk.

I have tried using the “uri” from the installed apps on the TV and it works fine (didn’t leave on long enough to see if it started some other app as you have noticed). Since the “uri” for these apps are quite long and difficult I have put a switch in the launchApp function to equate the app name to the “uri” in the action value. This seems to work as expected, so putting in “Emby” as the action replaces the value to the “uri” for “Emby” and starts it properly. I don’t have a lot of apps so the switch isn’t long and convoluted. Thanks for the help with this. On to the next challenge, trying to get an android TiVo box from a cable provider to work over IP. It seems to only partially comply with Android TV functionality and I need to figure out what functions work properly and find work arounds for areas where the box doesn’t behave as expected.
Cheers, Bruce.

@bmcbuff if you have altered or upgraded the Bravia plugin, if you please wouldn’t mind making a comment on the Bravia plugin page and write up a little paragraph of what you changed or upgraded and attach the plugin file.

Actually tried this and it worked for me. The Josep Fargas’s original plugin seemed to use the “title” as value in the launch app and somehow the “uri” got substituted as value but I can’t see how that would happen. I have built a switch statement in the launch app function that replaces the “title” with the actual “uri” so the data action in home remote will be simpler. I haven’t seen the behaviour you are mentioning on your tv but I have not used the function for very long, just testing. Thanks for the help. I put up a brief paragraph on what I did to get the plugin working with my setup, hope that is what you were asking for. Thanks again.

1 Like