Advanced Functionality with Embedding

This section explains the steps to implement advanced functionality with the embedded game on your website (HTML page).

To further enhance the gameplay experience of your embedded game, now.gg Embed SDK enables you to:

  • Pass events and data from your App on now.gg Cloud to your HTML page, and
  • Pass app launch parameters to your App on launch.
Prerequisite
  • Please download and integrate the now.gg Events module with your Android App to enable the following functionality.
1. Pass Events from your App to your HTML page

After you have integrated with now.gg Events module, you can pass events and data from your App on now.gg Cloud to your HTML page where the game is embedded.

Please refer toSend Events and Data to the HTML Page section of now.gg Events Module Documentation.

2. Pass Parameters from your HTML page to your App on Launch

You can now pass app launch parameters to your App from your HTML page. We have provided sample code snippets to define appLaunchData that is passed to NowIfp.init and to retrieve it in your App.

a. Define appLaunchData

The appLaunchData is passed as a parameter to the NowIfp.init(), which passes it to the App as a launch intent parameter. The following code illustrates how to pass appLaunchData to NowIfp.init().

NowIfp.init({
     clientId: <"your_clientId"> ,
     appId: <"your_appId"> ,
     iframeParentElement: iframeParentElement,
     customData: {} // for app-specific custom handling
     appLaunchData: {
           [key]: [value]
     } 
      // pass launch arguments to Iframe as it's at launch, It will be serialized and passed to the app at launch intent.
     appEventCallback: appEventCallbackFunction,
     sdkEventCallback: sdkEventCallbackFunction,
 });
b. Retrieve appLaunchData in your App

With this step, your App can retrieve the appLaunchData, which was sent from your HTML page to your App.

The following code snippet showcases how to retrieve the value using key from your App, as illustrated below:

//Retrieves the value using key passed as app launch parameter
 string value = NowGGEventsSdkManager.Instance.GetAppLaunchDataProperty(key);

Please refer to – Retrieve app Launch Data section of now.gg Events Module Documentation.

Important Information

  • The appLaunchData is only passed at App launch and cannot be passed when the App is running.
×

Document Rev. 1.0

Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg