-
This package gives' wrapper methods for deepwall sdks. iOS - Android
-
Before implementing this package, you need to have api_key and list of actions.
-
You can get api_key and actions from DeepWall Dashboard
$ cordova plugin add cordova-plugin-deepwall
- After adding plugin in the dependency section,
add
AndroidXEnabled
astrue
in theconfig.xml
of your application.
<preference name="AndroidXEnabled" value="true" />
-
IOS
- Set minimum ios version to 10.0 or higher in
platforms/ios/Podfile
like:platform :ios, '10.0'
- Add
use_frameworks!
intoplatforms/ios/Podfile
if not exists. - Run
$ cd platforms/ios && pod install
- Set minimum ios version to 10.0 or higher in
-
ANDROID
- Set
minSdkVersion
to 21 or higher.
- Set
- On application start you need to initialize sdk with api key and environment.
cordova.DeepwallCordovaPlugin.initialize('{API_KEY}', Environments.PRODUCTION, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- Before requesting any paywall you need to set UserProperties (device uuid, country, language). See all parameters
cordova.DeepwallCordovaPlugin.setUserProperties('UNIQUE_DEVICE_ID_HERE (UUID)','en-us','us', EnvironmentStyles.LIGHT, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- After setting userProperties, you are ready for requesting paywall with an action key. You can find action key in DeepWall dashboard.
cordova.DeepwallCordovaPlugin.requestPaywall('{ACTION_KEY}',{}, function(response){
console.log(response);
}, function(error){
console.log(error);
});
// You can send extra parameter if needed as below
cordova.DeepwallCordovaPlugin.requestPaywall('{ACTION_KEY}',{'sliderIndex': 2, 'title': 'Deepwall'}, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- You can also close paywall.
cordova.DeepwallCordovaPlugin.closePaywall(function(response){
console.log(response);
}, function(error){
console.log(error);
});
- When any of userProperties is changed, you need to call updateUserProperties method. (For example if user changed application language)
cordova.DeepwallCordovaPlugin.updateUserProperties('fr-fr','fr',EnvironmentStyles.LIGHT, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- You can validate receipts like below.
cordova.DeepwallCordovaPlugin.validateReceipt(ValidateReceiptTypes.RESTORE, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- There is also bunch of events triggering before and after DeepWall Actions. You may listen any event like below.
cordova.DeepwallCordovaPlugin.observeEvents(function(response){
console.log(JSON.stringify(response));
// access response.data
}, function(error){
console.log(error);
})
- You may remove event observers. (if you are reloading page you need to call this before location.reload())
cordova.DeepwallCordovaPlugin.removeEventObserver()
- Requesting ATT Prompts
cordova.DeepwallCordovaPlugin.requestAppTracking('{ACTION_KEY}',{}, function(response){
console.log(response);
}, function(error){
console.log(error);
});
// You can send extra parameter if needed as below
cordova.DeepwallCordovaPlugin.requestAppTracking('{ACTION_KEY}', {appName: "My awesome app"}, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- Sending extra data to paywall while it's open.
cordova.DeepwallCordovaPlugin.sendExtraDataToPaywall({appName: "My awesome app"}, function(response){
console.log(response);
}, function(error){
console.log(error);
});
- For consumable products, you need to mark the purchase as consumed for consumable product to be purchased again.
cordova.DeepwallCordovaPlugin.consumeProduct('consumable_product_id', function(response){
console.log(response);
}, function(error){
console.log(error);
});
- Use
setProductUpgradePolicy
method to set the product upgrade policy for Google Play apps.
cordova.DeepwallCordovaPlugin.setProductUpgradePolicy(
ProrationTypes.IMMEDIATE_WITHOUT_PRORATION,
PurchaseUpgradePolicy.ENABLE_ALL_POLICIES,
function(response){
console.log(response);
}, function(error){
console.log(error);
});
- Use
updateProductUpgradePolicy
method to update the product upgrade policy within the app workflow before requesting paywalls.
cordova.DeepwallCordovaPlugin.setProductUpgradePolicy(
ProrationTypes.IMMEDIATE_WITHOUT_PRORATION,
PurchaseUpgradePolicy.ENABLE_ONLY_UPGRADE,
function(response){
console.log(response);
}, function(error){
console.log(error);
});
- You may find complete list of events in enums/Events.js or Native Sdk Page