Package Gives Wrapper Methods for Deepwall Sdks

DeepWall (deepwall-react-native-sdk)

  • 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

Getting started

$ npm install deepwall-react-native-sdk --save

React Native 0.59 and below

Run react-native link deepwall-react-native-sdk to link the library.

Installation Notes

  • IOS

    • Set minimum ios version to 10.0 in ios/Podfile like: platform :ios, '10.0'
    • Add use_frameworks! into ios/Podfile if not exists.
    • Remove flipper from ios/Podfile if exists.
    • Run $ cd ios && pod install
  • ANDROID

    • Set minSdkVersion to 21 in android/build.gradle
    • Add maven { url 'https://raw.githubusercontent.com/Teknasyon-Teknoloji/deepwall-android-sdk/master/' } into android/build.gradle (Add into repositories under allprojects)

Usage

Let’s start

  • On application start you need to initialize sdk with api key and environment.
import DeepWall, { DeepWallEnvironments } from 'deepwall-react-native-sdk';

DeepWall.getInstance().initialize('API_KEY', DeepWallEnvironments.PRODUCTION);
  • Before requesting any landing page you need to set UserProperties (device uuid, country, language). See all parameters
import DeepWall, { DeepWallUserProperties } from 'deepwall-react-native-sdk';

DeepWall.getInstance().setUserProperties(
  new DeepWallUserProperties({
    uuid: 'UNIQUE_DEVICE_ID_HERE (UUID)',
    country: 'us',
    language: 'en-us',
  }),
);
  • After setting userProperties, you are ready for requesting a landing page with an action name. You can find the action name in the DeepWall dashboard.
DeepWall.getInstance().requestLanding('AppLaunch');
  • You can also close landing.
DeepWall.getInstance().closeLanding();
  • If any of userProperties is changed you need to call updateUserProperties method. (For example if user changed application language)
DeepWall.getInstance().updateUserProperties({
  language: 'fr-fr',
});
  • There is also bunch of events triggering before and after DeepWall Actions. You may listen any action like below.
import DeepWall, { DeepWallEventBus, DeepWallEvents } from 'deepwall-react-native-sdk';

DeepWallEventBus.getInstance().listen(DeepWallEvents.LANDING_OPENED, function (data) {
  console.log(
    'DeepWallEvents.LANDING_OPENED',
    data
  );
});
  • For example you may listen all events from sdk like below.
import { DeepWallEventBus, DeepWallEvents } from 'deepwall-react-native-sdk';

Object.values(DeepWallEvents).map((item) => {
  DeepWallEventBus.getInstance().listen(item, function (data) {
    console.log(item, data);
  });
});

Notes

  • You may found complete list of events in Enums/Events.js or Native Sdk Page
  • UserProperties are:
    • uuid
    • country
    • language
    • environmentStyle
    • debugAdvertiseAttributions

Troubleshooting

Android

  • If you get NATIVE_MODULE_NOT_FOUND error, that means you have to link this library manually.
    • Add new instance of Deepwall package into src/main/java/com/YOUR-APP-NAME/MainApplication.java
// MainApplication.java

...
import com.deepwall.RNDeepWallPackage;// <-- Add this line.
...

protected List<ReactPackage> getPackages() {
  List<ReactPackage> packages = new PackageList(this).getPackages();
  packages.add(new RNDeepWallPackage()); // <-- Add this line.
  return packages;
}

Download Details:

Author: Teknasyon-Teknoloji

Source Code: https://github.com/Teknasyon-Teknoloji/deepwall-react-native-sdk

#react-native #react #mobile-apps

Package Gives Wrapper Methods for Deepwall Sdks
2.25 GEEK