Technical Requirements
webOS Version | 5.0 or later |
webOS SDK | Latest version |
Downloads
webOS SDK | Download |
webOS Sample Application | Download |
Integration Guide
Sample application
Massive SDK comes with a sample application showing project configuration, API integration, and consent screen. To run the app, follow these steps:- Install the webOS Simulator.
- Extract the sample app and the SDK package provided by Massive.
- Copy
MassiveClient.js
from the SDK to the sample app’sjs/
directory. - Copy the API token from your Applications List.
- Set the token value to the
API_TOKEN
constant injs/apphelpers.js
. - Launch the webOS Simulator and load both the sample app and Massive service directories.
- Use the app buttons to initialize, start, and stop the SDK.
Dependency configuration
To integrate the Massive SDK into your webOS project:-
Add the SDK client file
Copy the
MassiveClient.js
file from the extracted SDK folder into thejs/
directory of your project. -
Import the client file
Add the following line to your
index.html
file: -
Configure the app domain
Replace
com.joinmassive.sampleapp.massivesdk
with your app’s domain in all Massive SDK files. Important: Keep the.massivesdk
suffix at the end. Update this string in the following files:MassiveClient.js
package.json
services.json
MassiveService.js
Integration to the app
1. Get the API token
Massive SDK API token is available in your Applications List.2. Initialize MassiveClient
Initialize the client with your API token and handle the result in the callback:3. Request consent from the user
Before starting the client, obtain user consent for the terms of resource exchange. Please see our launch checklist for additional details. Example consent text:4. Start usage after consent
After receiving the user’s consent, start usage using thestart()
method:
5. Stop usage
To stop the SDK usage:6. Query SDK status
You can query the SDK status at any time after initialization:Technical details
- Service architecture The Massive SDK for webOS uses a JavaScript service (JS Service) architecture that runs as a separate service component. This service handles the core operations independently of the main application, providing better performance and stability.
- Luna Service Bus The SDK utilizes webOS’s Luna Service Bus for communication between your application and the Massive service. This ensures secure and efficient inter-process communication within the webOS environment.
-
One-time initialization
The SDK should be initialized only once per application session. The initialization establishes communication with the service and prepares the SDK for operation. Subsequent calls to
init
will return the current state without reinitializing. -
User consent before starting usage
Before starting the SDK usage for the first time (using the
start()
method), it is mandatory to obtain user consent for the terms of resource exchange. This aligns with user privacy and control principles. Ensure that your application includes a clear and understandable consent mechanism. -
Starting and stopping the client
Initialization of the
MassiveClient
with theinit()
method does not automatically start the usage. It prepares the SDK for use but does not begin its operation. To ensure that Massive is running, thestart()
method must be called after initialization. Thestart()
method is designed to be idempotent, meaning it is safe to call multiple times. If the service is already started, subsequent calls will have no effect. Thestop()
method is used to stop the service operation. After callingstop()
, you can restart the client by calling thestart()
method again. - Persistent service with auto-start The Massive service is designed to persist across application sessions. Once initialized and started, it will continue to operate even when the main application is closed, subject to system resource management policies.
-
App domain configuration
Proper app domain configuration is crucial for the SDK to function correctly. The domain must be consistent across all SDK files and must end with
.massivesdk
. This ensures proper service registration and communication between components. Example: If your app domain iscom.mycompany.myapp
, the Massive service domain should becom.mycompany.myapp.massivesdk
. - Service packaging When packaging your webOS application, ensure that both the client JavaScript file and the service components are properly included. The service must be registered in the application manifest for proper operation.
-
Error handling
The SDK provides error handling through callbacks. Always implement proper error handling to ensure a smooth user experience:
- Global scope access The MassiveClient is attached to the window object for global access throughout your application. This design ensures easy integration with various JavaScript frameworks and patterns commonly used in webOS TV applications.
- Resource management The SDK is designed to operate efficiently within the resource constraints of webOS TV devices. It manages network and computational resources carefully to avoid impacting the user experience of your application or the overall TV performance.