Your app must request the "INTERNET" and "ACCESS_NETWORK_STATE" permissions. If your app already requests these permissions, skip to the next step.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
Add following import statement in your Activity before setContentView or in Application Context
import com.vessel.VesselSDK;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialise Vessel
VesselSDK.initialize(getApplicationContext(), secretKey);
.......
//Your code goes here
}
Add following line in your on create, onPause and onResume as follows.
@Override
protected void onPause() {
VesselAB.onPause(YOUR_ACTIVITY.this);
super.onPause();
}
@Override
protected void onResume() {
VesselAB.onResume();
super.onResume(YOUR_ACTIVITY.this);
}
In case if you are using ProGuard for your application, then add following lines in your proguard.cfg file, It will be located inside your project folder.It will exclude VesselSDK from obfuscation process.
-dontwarn com.vessel.*
-dontnote com.vessel.*
-keep class com.vessel.** { *; }
At this point you have successfully integrated VesselSDK in your application , to test the integration build and install application on your test device or on simulator. Proceed to next tutorial, enable in-app support desk.
Open your AppDelegate.m file. Import Vessel header as shown below.
#import <Vessel/Vessel.h>
To initilize Vessel Framework add the following line inside the application:didFinishLaunchingWithOptions function.
[[Vessel sharedInstance] initializeWithAppSecret:@"APP_KEY"];
Build and run your app.
$ phonegap local plugin add https://github.com/vesselio/PhoneGapPlugin.git
// To ensure if its added correctly execute following command
$phonegap local plugin list
[phonegap] com.vessel.abplugin
//Soon it will be available in official plugin directory.
After adding plugin open your main / index.html file and add
Attach Event listener on "deviceready" method as follows
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the PhoneGap API
// Initialize Vessel A/B testing platform. You can simply initialize it once.
var YOUR_SECRET_KEY = 'YOUR_APP_KEY';
vesselab.initialize(
function(){console.log("VesselSDK Init done.");},
function(error){ console.log("an error occurred:" + error); },
YOUR_SECRET_KEY
);
}
In case if you experience any problem while building your application for iOS platform then verify
Open the tiapp.xml and add the following entries.
<modules>
<!-- Other modules can be present here -->
<module platform="android" version="1.0">io.vessel</module>
<module platform="iphone" version="1.0">io.vessel</module>
</modules>
After adding module, VesselSDK should be initialized in app.js as follows.
var VesselSDK = require('io.vessel');
VesselSDK.initialize('<secret_key>');
In WMAppManifest.xml go to Capabilities tab. Make sure the following options are enabled:
ID_CAP_IDENTITY_DEVICE
ID_CAP_NETWORKING
ID_CAP_LOCATION
Add sdk initialization to App.xaml.cs:
using Vessel;
...
private void Application_Launching(object sender, LaunchingEventArgs e)
{
VesselSDK.initialize("secret_key");
}