This document describes the installation and usage of the Cordova plugin for the Appsfire iOS SDK.
- Appsfire SDK >= 2.7.0
- Cordova CLI >= 3.0
The Cordova plugin of Appsfire SDK currently works only for iOS. However its integration shouldn't affect the build on any other platform.
This documentation is a brief introduction to Appsfire SDK for Cordova. We recommend you to take a look on the general documentation that you can find in your dashboard. Most of methods were implemented in Cordova. If you have a problem during the integration, don't hesitate to contact our team at [email protected].
We recommend you to read the integration reference documentation that you find at this URL.
The Appsfire SDK is the cornerstone of the Appsfire network.
It provides the functionalities for monetizing your mobile application: it facilitates inserting native mobile ads into you application using native APIs. You can choose one of our ad units (Sushi, Uramaki).
It also helps you engage with your users by sending push and in-app notifications.
- Please visit our website to learn more about our ad units and products.
- Please visit our iOS online documentation to learn how to integrate our SDK into your iOS app.
- Check out the full iOS API specification to have a detailed understanding of our iOS SDK.
In order to get started, please be sure you've done the following:
- Registered on Appsfire website and accepted our Terms Of Use
- Registered your app on our Dashboard and generated an SDK key for your app
- Grabbed our latest version of the SDK and Cordova plugin from our Dashboard
cordova plugin add PATH/appsfire-sdk-cordova-plugin
cordova prepare
You will first need to initialize the Appsfire SDK with your SDK Token and the features you need.
var af = new AppsfireSDK();
// Set your SDK Token.
var sdkToken = '';
// Set your Secret Key.
var sdkToken = '';
// Connection to the API.
af.afsdk_connectWithParameters(
sdkToken,
secretKey,
['AFSDKFeatureEngage', 'AFSDKFeatureMonetization'],
function() {
console.log('SDK correctly initialized.');
},
function() {
console.log('SDK failed to initialize.');
});
Now that you've correctly initialized the SDK you can:
- Show interstitial Ads:
// First we need to check if we have a sushi modal (interstitial).
af.afadsdk_isThereAModalAdAvailable('sushi', function(isThereAModalAdAvailable) {
// If we have one, then we can request to show one.
if (isThereAModalAdAvailable) {
af.afadsdk_requestModalAd('sushi');
}
});
- Present the panel of Notifications or Feedback:
af.afengagesdk_presentPanel('notifications', 'fullscreen',
function() {
console.log('Presented');
},
function() {
console.log('No Presented');
});
In order to get test ads, you can also set the DEBUG mode:
af.afadsdk_setDebugModeEnabled(true);
It is important to make sure to remove this line in Production builds.
For a full list of the available methods you'll need to check the appsfire.js
file.