cordova-plugin-lan-sdk
v0.1.0
Published
cordova plugin for Linkedin Audience Network SDK
Downloads
11
Maintainers
Readme
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.
Create a cordova iOS sample APP named testApp
cordova create testApp cd testApp
Add iOS platform for this sample APP.
cordova platform add ios
Add LanSDKPlugin for this sample APP.
cordova plugin add cordova-plugin-lan-sdk
Get into /platform/ios, do
pod install
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); }); }); });
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.