-
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
NOTE: This package has
null safety
enabled that means you need2.12.0
or higher version of flutter.
Add below code into your pubspec.yaml
file under dependencies
section.
deepwallkids_flutter_plugin:
git:
url: https://github.com/Teknasyon-Teknoloji/deepwallkids-flutter-sdk.git
ref: 1.0.1
And run $ flutter pub get
-
IOS
- Set minimum ios version 10.0 or higher in
ios/Podfile
like:platform :ios, '10.0'
- Add
use_frameworks!
intoios/Podfile
if not exists. - Run
$ cd ios && pod install
- Set minimum ios version 10.0 or higher in
-
ANDROID
- Set kotlin_version "1.4.32" or higher in
android/build.gradle
- Set
minSdkVersion
to 21 or higher inandroid/app/build.gradle
- Add
maven { url 'https://raw.githubusercontent.com/Teknasyon-Teknoloji/deepwall-android-sdk/master/' }
intoandroid/build.gradle
(Add into repositories under allprojects)
- Set kotlin_version "1.4.32" or higher in
- On application start you need to initialize sdk with api key and environment.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallKidsFlutterPlugin.initialize('{API_KEY}', Environment.PRODUCTION.value);
- Before requesting any paywall you need to set UserProperties (device uuid, country, language). See all parameters
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallKidsFlutterPlugin.setUserProperties('UNIQUE_DEVICE_ID_HERE (UUID)', 'en-us', 'us');
- After setting userProperties, you are ready for requesting paywall with an action key. You can find action key in DeepWall dashboard.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallKidsFlutterPlugin.requestPaywall('{ACTION_KEY}', null);
// You can send extra parameter if needed as below
Map<String, Object> extraData = new HashMap();
extraData['sliderIndex'] = 2;
extraData['title'] = 'DeepWallKids';
DeepWallKidsFlutterPlugin.requestPaywall('{ACTION_KEY}', extraData);
- You can also close paywall.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallKidsFlutterPlugin.closePaywall();
- When any of userProperties is changed, you need to call updateUserProperties method. (For example if user changed application language)
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallKidsFlutterPlugin.updateUserProperties('fr-fr','fr');
- You can validate receipts like below.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallKidsFlutterPlugin.validateReceipt(ReceiptValidationType.RESTORE.value);
- There is also bunch of events triggering before and after DeepWallKids Actions. You may listen any event like below.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
StreamSubscription subscribeToStream =
DeepWallKidsFlutterPlugin.eventBus.on<DeepWallKidsFlutterEvent>().listen((event) {
// // access event.data
});
- Adding and removing event listener example
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
StreamSubscription subscribeToStream =
DeepWallFlutterPlugin.eventBus.on<DeepWallKidsFlutterEvent>().listen((event) {
// // access event.data
});
subscribeToStream.cancel();
- Sending extra data to paywall while it's open.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
Map<String, Object> extraData = new HashMap();
extraData['appName'] = 'My awesome app';
DeepWallFlutterPlugin.sendExtraDataToPaywall('{ACTION_KEY}', extraData);
- For consumable products, you need to mark the purchase as consumed for consumable product to be purchased again.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallFlutterPlugin.consumeProduct('consumable_product_id');
- Use
setProductUpgradePolicy
method to set the product upgrade policy for Google Play apps.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallFlutterPlugin.setProductUpgradePolicy(
ProrationMode.IMMEDIATE_WITHOUT_PRORATION.value,
Policy.ENABLE_ALL_POLICIES.value
);
- Use
updateProductUpgradePolicy
method to update the product upgrade policy within the app workflow before requesting paywalls.
import 'package:deepwallkids_flutter_plugin/deepwallkids_flutter_plugin.dart';
DeepWallFlutterPlugin.updateProductUpgradePolicy(
ProrationMode.IMMEDIATE_WITHOUT_PRORATION.value,
Policy.ENABLE_ALL_POLICIES.value
);
- You may found complete list of events in lib/enums/events.dart or Native Sdk Page
- UserProperties are:
- uuid
- country
- language
- environmentStyle