cordova-plugin-lan-sdk

0.1.0 • Public • Published

cordova-plugin-lan-sdk

Cordova plugin for Linkedin Audience Network SDK.

This plugin enables users to use Linkedin Audience Network SDK in cordova platform.

Installation

  • iOS

    Use cordova plugin add command to download and add lan-sdk plugin.

    cordova plugin add cordova-plugin-lan-sdk

Supported Platforms

  • iOS

    Note: You need to specify Swift version(e.g. Swift 5.0) in your iOS Sample APP's build settings created by Cordova command.

  • Android

iOS Methods

  • LanSDKPlugin.startWithKey
  • LanSDKPlugin.getBidderToken
  • LanSDKPlugin.getSdkVersion

LanSDKPlugin.startWithKey

Start LAN SDK with an API-Key.

LanSDKPlugin.startWithKey(APIKey, function(){...}, function(error){...});

LanSDKPlugin.getBidderToken

Get bidder Token.

LanSDKPlugin.getBidderToken(function(bidderToken){...}, function(error){...});

LanSDKPlugin.getSdkVersion

Get SDK version information.

LanSDKPlugin.getSdkVersion(function(sdkVersion) {...}, function(error) {...});

Your application should call LanSDKPlugin.getBidderToken after completion of calling LanSDKPlugin.startWithKey.

How to test this plugin in a sample APP.

  1. Create a cordova iOS sample APP named testApp

    cordova create testApp
    cd testApp
  2. Add iOS platform for this sample APP.

    cordova platform add ios
  3. Add LanSDKPlugin for this sample APP.

    cordova plugin add cordova-plugin-lan-sdk
  4. Get into /platform/ios, do

    pod install
  5. Change the index.js of the cordova app with below code, replace the API_KEY with the one we assigned to you.

    LanSDKPlugin.startWithKey("API_KEY", function() {
            console.log("startWithKey success");
            console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
            console.log("sdkVersion: " + LanPlugin.sdkVersion)
            document.getElementById('deviceready').classList.add('ready');
        }, function(error) {
            console.error("Error", error);
            LanSDKPlugin.getBidderToken(function(bidderToken) {
                console.log("bidderToken Value:", bidderToken);
            }, function(error) {
                console.error("Error getting bidderToken value", error);
                LanSDKPlugin.startWithKey("API_KEY", function() {
                    console.log("startWithKey success");
                    console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
                    LanSDKPlugin.getSdkVersion(function(sdkVersion) {
                        console.log("sdkVersion Value:", sdkVersion);
                    }, function(error) {
                        console.error("Error getting sdkVersion value", error);
                    });
                    LanSDKPlugin.getBidderToken(function(bidderToken) {
                        console.log("bidderToken Value:", bidderToken);
                    }, function(error) {
                        console.error("Error getting bidderToken value", error);
                    });
                    document.getElementById('deviceready').classList.add('ready');
                }, function(error) {
                    console.error("Error", error);
                });
            });
        });
  6. Specify Swift version in build.settings of the APP, for example, Swift 5.0, then build and run the app, watch in console if value of biddertoken is showing up there.

Package Sidebar

Install

npm i cordova-plugin-lan-sdk

Weekly Downloads

1

Version

0.1.0

License

BSD 2-CLAUSE LICENSE

Unpacked Size

8.85 kB

Total Files

7

Last publish

Collaborators

  • aim-lan-sdk