Setup
The LoyaltyLion SDK supports bi-directional communication with your mobile app to facilitate more advanced features.
For example, with Shopify mobile apps this can be used to have LoyaltyLion ask your app to add a voucher code or free product to the current cart.
Setting up a WebView for advanced features
When LoyaltyLion is embedded in a WKWebView
, we’ll use the WKScriptMessageHandler
interface to send messages to your app.
You’ll need to register the listeners you want to support with your content controller, and then handle
them appropriately. The example below listens to the ready
event to detect when the Loyalty Page has finished loading.
When LoyaltyLion is embedded in a WKWebView
, we’ll use the WKScriptMessageHandler
interface to send messages to your app.
You’ll need to register the listeners you want to support with your content controller, and then handle
them appropriately. The example below listens to the ready
event to detect when the Loyalty Page has finished loading.
When LoyaltyLion is embedded in an Android WebView, you can add a LoyaltyLionBridge
JavaScript interface which we’ll use to emit events.
The example below sets up a WebView, registers the LoyaltyLionBridge
and registers a ready
handler to detect when the Loyalty Page has finished loading.