Cordova plugin for Linkedin Audience Network SDK.
This plugin enables users to use Linkedin Audience Network SDK in cordova platform.
-
iOS
Use cordova plugin add command to download and add lan-sdk plugin.
cordova plugin add cordova-plugin-lan-sdk
-
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
- LanSDKPlugin.startWithKey
- LanSDKPlugin.getBidderToken
- LanSDKPlugin.getSdkVersion
Start LAN SDK with an API-Key.
LanSDKPlugin.startWithKey(APIKey, function(){...}, function(error){...});
Get bidder Token.
LanSDKPlugin.getBidderToken(function(bidderToken){...}, function(error){...});
Get SDK version information.
LanSDKPlugin.getSdkVersion(function(sdkVersion) {...}, function(error) {...});
Your application should call LanSDKPlugin.getBidderToken
after completion of calling LanSDKPlugin.startWithKey
.
-
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.