Entertainment Center Developers Docs

Integrate Broad Solutions Entertainment Center into your app and monetize with ads via SDK or WebView. Enable secure Offerwall reward callbacks.

SDK Integration

Overview

The Joyloop SDK allows you to embed Joyloop's monetized game pages directly inside your Android application. It provides:

  • Controlled in-app game rendering
  • Built-in ad monetization
  • Offerwall task context support
  • Server-to-server reward callback integration
  • Layout customization via WebView margins

SDK integration is recommended for partners who require deeper control over lifecycle events, layout positioning, and offerwall reward tracking.

Requirements

Before integration, ensure:

  • Android API Level 21+ (Android 5.0 or higher)
  • Internet permission enabled
  • WebView enabled in your app
  • Stable network environment for ad loading
  • You have received a valid appId from Broad Solutions

Initialize SDK

Initialization must be completed before calling any SDK method.

BsMonetizeSDK.getInstance().init(
    this,
    "YOUR_APP_ID",
    new InitCallback() {
        @Override
        public void onSuccess() {
            Log.d("Joyloop", "SDK initialized successfully");
        }

        @Override
        public void onFailure(String errorMsg) {
            Log.e("Joyloop", "SDK init failed: " + errorMsg);
        }
    }
);
                

Parameters

Parameter Description
context Android context
appId Unique client identifier provided by Joyloop
InitCallback Initialization success/failure callback

You must wait for onSuccess() before displaying the game page.

Show Game Page

After successful initialization, display the Joyloop game page:

private void setupCallbacks() {
    BsMonetizeSDK.getInstance().showWeb(
        new WebViewMargins(0, 0, 0, 300),
        new BsMonetizeSDK.AdShowCallback() {
            @Override
            public void onSuccess() {

            }

            @Override
            public void onError(Throwable throwable) {
                Log.e("BSSDK", "RewardError", throwable);
            }
        }
    );
}
                

WebViewMargins Explanation

Field Meaning
left Left margin (px)
top Top margin (px)
right Right margin (px)
bottom Bottom margin (px)

This allows flexible positioning inside your layout.

Enable Offerwall Mode

To enable reward tracking, pass task context JSON as the second parameter of showWeb():

BsMonetizeSDK.getInstance().showWeb(
    new WebViewMargins(0, 0, 0, 300),
    "{\"userId\":\"123\",\"token\":\"USER_AUTH_TOKEN\",\"taskId\":\"789\"}"
);
                

Task Context Fields

Field Required Description
userId Yes Client's internal user identifier
token Yes Client-generated user auth token (JWT or HMAC). NOT reward amount
taskId Yes Offerwall task identifier

Important:

  • token is NOT reward amount.
  • Reward amount is determined by Broadsultions server configuration.
  • token should be verifiable by the client (JWT or HMAC recommended).
  • Broadsultions echoes token back in callback for verification.

Testing Checklist

Before going live:

  • SDK initializes successfully
  • Game page loads without white screen
  • Ads render correctly
  • Offerwall callback endpoint is reachable
  • Signature verification works
  • Duplicate callback handling is implemented

Troubleshooting

SDK Init Failure

  • Verify appId is correct
  • Check network connectivity
  • Confirm Internet permission is enabled

Game Page Not Displaying

  • Ensure onSuccess() is triggered before calling showWeb()
  • Confirm WebView is not restricted by ProGuard or network security policy

WebView Integration

Overview

WebView integration allows partners to directly load Joyloop's game page URL inside their app without integrating the SDK.

This is the fastest way to integrate.

Quickstart

Step 1 — Append required parameter
https://joyloopgame.com/?appId=YOUR_APP_ID

Step 2 — Open URL in WebView
Load the URL in your app's WebView.

Step 3 — Verify

  • Game loads correctly
  • Ads render correctly
  • No navigation blocking occurs

Required URL Parameters

Param Required Description
appId Yes Client identifier

Enable Offerwall Mode via URL

Append task context parameters:

https://joyloopgame.com/?appId=YOUR_APP_ID&userId=123&token=USER_AUTH_TOKEN&taskId=789
                
Param Required (Offerwall) Description
userId Yes Client user ID
token Yes User auth token (JWT/HMAC)
taskId Yes Task identifier

Recommended WebView Settings

Android

  • Enable JavaScript
  • Enable DOM storage
  • Enable third-party cookies
  • Do not block mixed content

iOS (WKWebView)

  • Enable JavaScript
  • Allow cookies
  • Ensure navigation delegate does not block redirects

Common Issues

Blank Screen

  • Check JavaScript settings
  • Verify HTTPS not blocked
  • Ensure no CSP restrictions

Ads Not Rendering

  • Check appId
  • Confirm network connectivity
  • Ensure cookies enabled

Offerwall Callback

Overview

When a user completes the task condition inside the Joyloop game page, Joyloop sends a server-to-server callback to the client.
In Security Mode v2:

  • Client does NOT send reward amount.
  • Joyloop server calculates reward based on appId + taskId.
  • Callback includes reward details.

Enablement

Client must provide:

  • callbackUrl
  • callbackSecret (shared secret for signature validation)

Callback Request

Method: POST
Content-Type: application/json

Headers

Header Description
X-Joyloop-Timestamp Unix timestamp (seconds)
X-Joyloop-Nonce Random UUID
X-Joyloop-Event-Id Unique reward event ID
X-Joyloop-Signature HMAC-SHA256 signature

Request Body Example

{
  "eventId": "evt_01HTABCDEF",
  "appId": "YOUR_APP_ID",
  "taskId": "789",
  "userId": "123",
  "token": "USER_AUTH_TOKEN",
  "reward": {
    "amount": 100,
    "currency": "COIN"
  },
  "occurredAt": 1730000000
}
                

Body Fields

Field Description
eventId Unique event ID
appId Client ID
taskId Task ID
userId User ID
token Auth token
reward.amount Reward amount (server-determined)
reward.currency Reward currency
occurredAt Event timestamp

Reward Computation

Reward amount is determined by Joyloop configuration:
reward = config(appId, taskId)
Client cannot modify reward amount.

Signature Verification

String to sign

stringToSign = timestamp + "." + nonce + "." + rawBody

Signature

signature = HMAC_SHA256(callbackSecret, stringToSign)

Client must:

  • Validate timestamp within ±5 minutes
  • Prevent nonce replay (cache 10 minutes)
  • Verify signature (constant-time compare)

Idempotency

Joyloop uses at-least-once delivery.

Client must:

  • Store processed eventId
  • Ignore duplicates
  • Ensure reward granted only once

Success Response

HTTP 200

{
  "code": 0,
  "message": "ok"
}
                

Retry Policy

If callback fails:

  • Retry up to 6 times
  • Backoff intervals:

1s → 5s → 30s → 2m → 10m → 30m

Security Notes

  • Never store callbackSecret in mobile app
  • Always validate signature
  • Do not trust userId without token validating
  • Implement idempotency