ConnectSDK / Connect-SDK-Android

Android source project for Connect SDK
Apache License 2.0
308 stars 130 forks source link

Get icon of installed apps on WebOS TV LG kotlin #412

Open kun510 opened 7 months ago

kun510 commented 7 months ago

I'm making a sample about remote on LG TV using webOS with ConnectSDK. I can remote with some basic command, get the list of installed apps on the TV. The data of each item like this: {"defaultWindowType":"card","requiredPermissions":["all"],"allowWidget":false,"uiRevision":1,"CPApp":false,"systemApp":true,"version":"1.0.0","enableBackgroundRun":true,"vendor":"LG Electronics, Inc.","enableCBSPolicy":false,"hasPromotion":false,"class":{"hidden":true},"tileSize":"normal","icon":"https:\/\/192.168.5.253:3001\/resources\/222fe81584d0dda9a0b9b7951e9206581c1409d9\/AirPlay_Icon-77x77.png","lockable":true,"privilegedJail":false,"useCORSWhitelist":"cors_whitelist.json","checkUpdateOnLaunch":true,"transparent":true,"handlesRelaunch":false,"spinnerOnLaunch":true,"id":"airplay","unmovable":false,"inspectable":false,"mediaExtension":{"mse":{"enableSourceBufferFlush":true,"maxVideoSourceBuffer":150,"disableVideoIntrinsicSize":true,"enableServerSideTrick":true}},"inAppSetting":false,"trustLevel":"trusted","mediumLargeIcon":"AirPlay_Icon-115x115.png","title":"AirPlay","deeplinkingParams":"{\"contentTarget\" : \"$CONTENTID\"}","noSplashOnLaunch":true,"visible":false,"accessibility":{"supportsAudioGuidance":true},"folderPath":"\/usr\/palm\/applications\/airplay","networkStableTimeout":0,"main":"launch.html","removable":false,"type":"web","disableBackHistoryAPI":true,"installTime":0} 2024-03-29 13:57:47.123 9057-9057

With above data, I have url of icon: https://192.168.5.253:3001//resources//222fe81584d0dda9a0b9b7951e9206581c1409d9//AirPlay_Icon-77x77.png But I can't get icon from this url I can't find any document about this. Can anyone help me? Thanks a lot

MuhammadAsad786 commented 6 months ago

any fix this issue about loading app icon in LG (webOs )

kun510 commented 6 months ago

any fix this issue about loading app icon in LG (webOs )

What do you need, I fixed that

MuhammadAsad786 commented 6 months ago

any fix this issue about loading app icon in LG (webOs )

What do you need, I fixed that

which url you to load for image , i use https://ip:port/query/icon/appid this link is working fine on Roku service but no working on WebOs service

kun510 commented 6 months ago

I changed the link of get Icon to ssap://com.webos.applicationManager/listLaunchPoints

MuhammadAsad786 commented 6 months ago

I changed the link of get Icon to ssap://com.webos.applicationManager/listLaunchPoints

Can you provide me proper link Because i think ssap not load from glide

kun510 commented 6 months ago

I have displayed it by passing the icon to the link ssap://com.webos.applicationManager/listLaunchPoints Then I processed it using glide

MuhammadAsad786 commented 6 months ago

I have displayed it by passing the icon to the link ssap://com.webos.applicationManager/listLaunchPoints Then I processed it using glide

Ssap://com.webos.applicationManaget/appid

This link Right?

kun510 commented 6 months ago

I get the API from the link ssap://com.webos.applicationManager/listLaunchPoints then I get the data and get the display icon from iconLink in ssap's Api json

MuhammadAsad786 commented 6 months ago

when i get the applist throught launcher.getapplist(). this method give me list of apps. In applist i have id, name , raw variable ,

so how to create a url for app icon with these variable

kun510 commented 6 months ago

In raw there is data {"defaultWindowType":"card","appsize":4696313,"CPAp":false,"systemApp":false,"version":"5.0.1","enableCBSPolicy":false,"vendor":"YuppTV" ,"hasPromotion":false,"tileSize":"normal","extraLargeIcon":"26145206897846570_16999277_192x192.png","largeIcon":"largeIcon.png","lockable":true,"transparent":false,"icon" :"https:\/\/192.168.5.253:3001\/resources\/4dabe31cfa8c527aed4135b5749a845833e2ae6f\/icon.png","checkUpdateOnLaunch":true,"spinnerOnLaunch":true,"handlesRelaunch":false,"unmovable":false, "id":"yupptv","inspectable":false,"noSplashOnLaunch":false,"privilegedJail":false,"trustLevel":"default","mediumLargeIcon":"26145206880621944_16999277_115x115.png","splashBackground":"images \/splash-screen.png","binId":465916,"title":"YuppTV","resolution":"1920x1080","visible":true,"deeplinkingParams":"","requiredEULA":"generalTerms ","inAppSetting":false,"accessibility":{"supportsAudioGuidance":false},"folderPath":"\/media\/cryptofs\/apps\/usr\/palm\/applications\/yupptv","bgImage ":"images\/LauncherBG.png","installTime":1625244800,"type":"web","main":"index.html","iconColor":"#17191c","disableBackHistoryAPI":true, "removable":true} You just need to get the link from the icon, then put the link in trustManager, then pass it to glide and it will display

chabelets commented 5 months ago

Hey @kun510. I use Flutter and platform channel for connectSDK. I got the raw data and I got icon link that not working. I found this method in ConnectSDK, how should I use this?

WebOSTVService(null, null).getLaunchPoints(object : LaunchPointsListener {
                override fun onError(error: ServiceCommandError?) {
                    TODO("Not yet implemented")
                }
                override fun onSuccess("object": JSONArray?) {
                    TODO("Not yet implemented")
                }
            }
        )
kun510 commented 5 months ago

@chabelets Use your device to call funcion launcher in ConnectableDevice's , then call funcion getLaunchPoints in WebOSTVService's and set the log. sample : deviceConnected?.launcher?.getLaunchPoints(object : Launcher.LaunchPointsListener {

             override fun onError(error: ServiceCommandError) {
                 Log.d("####", "onError: $error")
                 callback.onError(error,deviceConnected?.ipAddress ?: "", deviceConnected?.friendlyName ?: "")
             }

             override fun onSuccess(objectLG: JSONArray?) {
                 callback.onSuccess(objectLG, deviceConnected?.ipAddress ?: "", deviceConnected?.friendlyName ?: "")

             }
         })
chabelets commented 5 months ago

Thanks a lot. Works like a charm.

@chabelets Use your device to call funcion launcher in ConnectableDevice's , then call funcion getLaunchPoints in WebOSTVService's and set the log. sample : deviceConnected?.launcher?.getLaunchPoints(object : Launcher.LaunchPointsListener {

             override fun onError(error: ServiceCommandError) {
                 Log.d("####", "onError: $error")
                 callback.onError(error,deviceConnected?.ipAddress ?: "", deviceConnected?.friendlyName ?: "")
             }

             override fun onSuccess(objectLG: JSONArray?) {
                 callback.onSuccess(objectLG, deviceConnected?.ipAddress ?: "", deviceConnected?.friendlyName ?: "")

             }
         })
chabelets commented 5 months ago

Have you try get icon in iOS app, it seems ConnectSDK-iOS doesn't contain listLaunchPoints

kun510 commented 5 months ago

it's just like android

kun510 commented 5 months ago

Have you connected to fire tv yet?

chabelets commented 5 months ago

android

A can't find getLaunchPoints request in ConnectSDK-iOS, should I create this request manually?

Have you connected to fire tv yet?

No I haven't. I connected to WebOS for LG tv

MuhammadAsad786 commented 5 months ago

Use the old version pod in ios , you will get the response id, name, icon . Get the icon in the list to show

kun510 commented 5 months ago

@MuhammadAsad786 yes sure !