CastarSDK
English
English
  • Welcome
  • Setup Guide
  • Add your APP
  • Quick access to SDK
    • Windows
    • Android
    • IOS
    • Android TV
    • Linux
    • LG WebOS
  • Data testing
  • Earn income
Powered by GitBook
On this page
  • Integration options
  • Other questions
  • How to check the docking status after the docking is completed?
  • After the docking is completed, there is no data on the dashboard after the hang-up test?
  • Contact us
  1. Quick access to SDK

LG WebOS

This guide is for developers who want to monetize LG WebOS applications with CastarSDK.

PreviousLinuxNextData testing

Last updated 2 months ago

Integrating the CastarSDK into an application is the first step toward earning revenue. Once you've integrated the SDK, you will start seeing devices data and revenue in in 24 hours.

This document will walk you through the steps needed to be taken in order to properly integrate CastarSDK into your application.

Integration options

Step 1: Apply for ClientId

Go applications -> -> create your ClientId for WebOS

Step 2: Download the SDK

Click to download now.

Step 3: Prepare the files.

(1) Open sdk/service/package.json and set a correct name attribute, preserve .packet_sdk_service postfix at the end.

(2) Open sdk/service/services.json and set a correct id, services[0].id and services[0].name attributes, preserve .packet_sdk_service postfix at the end.

(3) ID in configuration files must comply with . When you add JS services into your app, do not include minus signs (-) or .(period)+number (for example, abc-1.0) in your app ID, because Luna Service does not allow them in a JS service name and the service name must begin with the app ID.

Step 4:Set up the SDK

(1) Copy the service directory next to other services that you already use

(2) Refer to the example in the compressed file castarsdk_webos.zip, integrate CastarSDK in your code

(3) After each start of the JS backend service, subscribe to the status of the SDK through the subscribe_sdk_status API for future checks on successful integration

(4) Set the application key through the set_appkey API

(5) Start the SDK through the start_castar_sdk API.

<script src="lib/webOSTV.js" charset="utf-8"></script>

// Replace "luna://com.company.app.castarsdk_service" with your actual URI based on the "name" you set in "Prerequisites-Step 3: Prepare the files".
function subscribeSdkStatus(){
  webOS.service.request("luna://com.company.app.castarsdk_service", {
    method: "subscribe_sdk_status",
    parameters: { subscribe: true },
    onSuccess: function (response) {
      if(response.code == 0){
        let appkey = response.data.appkey;
        let sdk_version = response.data.sdk_version;
        let sdk_started_status = response.data.sdk_started_status;
        let sdk_detailed_status_message = response.data.sdk_detailed_status_message;
      }
    },
    onFailure: function (response) {
      console.log("LS2 API 'get_sdk_status' call failed.");
    },
  });
}

const app_key = "test";   // Replace the "test" with your actual appkey.
function setAppKey(){
  webOS.service.request("luna://com.company.app.castarsdk_service", {
    method: "set_appkey",
    parameters: {
      appkey: app_key
    },
    onSuccess: function (response) {
      if(response.code == 0){
        console.log("Set appkey successfully, message: " + response.message);
      }else{
        console.log("Set appkey failed, error code: " + response.code + " error message:" + response.message);
      }
    },
    onFailure: function (response) {
      console.log("LS2 API 'set_appkey' call failed.");
    }
  });
}

function startCastarSDK(){
  webOS.service.request("luna://com.company.app.castarsdk_service", {
    method: "start_castar_sdk",
    parameters: {},
    onSuccess: function (response) {
      if(response.code == 0){
        console.log("Start CastarSDK successfully, message: " + response.message);
      }else{
        console.log("Start CastarSDK failed, error code: " + response.code + " error message: " + response.message);
      }
    },
    onFailure: function (response) {
      console.log("LS2 API 'start_castar_sdk' call failed.");
    }
  });
}

function stopCastarSDK(){
  webOS.service.request("luna://com.company.app.castarsdk_service", {
    method: "stop_castar_sdk",
    parameters: {},
    onSuccess: function (response) {
      if(response.code == 0){
        console.log("Stop CastarSDK successfully, message: " + response.message);
      }else{
        console.log("Stop CastarSDK failed, error code: " + response.code + " error message: " + response.message);
      }
    },
    onFailure: function (response) {
      console.log("LS2 API 'stop_castar_sdk' call failed.");
    }
  });
}

Other questions

How to check the docking status after the docking is completed?

You can check the docking status of the SDK in the Dashboard - Applicatiopns menu. After the SDK is integrated and initialized successfully, you can check the activation status on the Dashboard. There is a 10-15 minute delay in the first activation status. Please wait patiently for the status update.

After the docking is completed, there is no data on the dashboard after the hang-up test?

Our Dashboard data refresh time is 0:00 every day to settle the previous day's earnings. After you generate data today, please query the test data the next day. We will settle your previous day's earnings the next day.

Contact us

If you have other questions, you can consult through the Livechat customer service window on the right side of the dial and official website, or you can contact our customer service staff through the following channels

Official email : support@castarsdk.com

WhatsAPP :

Skype :

CastarSDK Dashboard
Add
SDK for WebOS
LG naming guidelines
https://whatsapp.com/channel/0029Vb0bHo50gcfFe6kQJR0a
https://join.skype.com/invite/ptBB6eukfkdX