Skip to content

mapp-digital/Mapp-Engage-ReactNative-Plugin

Repository files navigation

react-native-mapp-plugin

Getting started

Site | Docs |TestApk

Installation from npm:

$ npm install react-native-mapp-plugin --save

Mostly automatic installation

For the old version of RN, $ react-native link react-native-mapp-plugin

Manual installation

iOS

  1. Install pods
cd ios && pod install
  1. Add the following capabilities for your application target:
  • Push Notification
  • Background Modes > Remote Notifications
  • Background Modes > Location updates
  1. Create a plist AppoxeeConfig.plist and include it in your application’s target:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>inapp</key>
    <dict>
        <key>custom_fields</key>
        <array>
            <string>customString</string>
            <string>customNumber</string>
            <string>customDate</string>
        </array>
        <key>media_timeout</key>
        <integer>5</integer>
    </dict>
    <key>sdk</key>
    <dict>
        <key>app_id</key>
        <string>your app id</string>
        <key>dmc_system_id</key>
        <integer>your dmc id</integer>
        <key>sdk_key</key>
        <string>your sdk key</string>
        <key>is_eu</key>
        <true/>
        <key>open_landing_page_inside_app</key>
        <false/>
        <key>jamie_url</key>
        <string>your inapp server url</string>
        <key>apx_open_url_internal</key>
        <string>YES</string>
    </dict>
</dict>
</plist>

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNMappPluginPackage; to the imports at the top of the file
  • Add new RNMappPluginPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-mapp-plugin'
    project(':react-native-mapp-plugin').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-mapp-plugin/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-mapp-plugin')
    

Usage

import Mapp from 'react-native-mapp-plugin';

// TODO: What to do with the module?
Mapp;