/
Flutter Integration to Mapp Cloud

Flutter Integration to Mapp Cloud

Acknowledgments 

  • iOS: Mapp plugin supports iOS10 and above

  • Android: Mapp plugin supports for Android 21 (Lollipop) and above


Prerequisites

Installation 

Before you run this command please check flutter with command flutter doctor , if your XCode doesn’t set correctly the podfile at iOS folder will not be automatically created for you.

  • Use command flutter pub add mapp_sdk

 

Android Setup:

apply plugin: 'com.google.gms.google-services'
  • Set in build.gradle file targetSdkVersion:

targetSdkVersion 33

Minimum supported SDK version is 21.

minSdkVersion 21

 

iOS

  1. Open podfile, uncomment # platform :ios, '9.0' line and increase iOS to 10.0. Search for line with use_frameworks! and comment it by adding #

  2. Install pods

cd example/ios && pod install

this should install automatically pod
if you are using M1 mac for development you would probably need to run
cd example/ios && pod install --repo-update
if it still doesn’t work try adding arch -x86_64 before pod install

  1. Add the following capabilities for your application target:

  • Push Notification

  • Background Modes > Remote Notifications

  • Background Modes > Location updates (if you want to use geotargeting)

 

  1. Create a plist `AppoxeeConfig.plist` and include it in your application’s target (this file must be present at Build Phases → Copy Bundle Resources):

<?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>

 Rich push

iOS

  1. If using Rich notifications follow instructions from this page:

Rich Push Notifications Integration for iOS

Android

In launcher activity of client aplication override methods onCrete and onNewIntent on following way:

 

public class MainActivity extends FlutterActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MappSdkPlugin.handleIntent(this,getIntent()); // add this call to handle rich push when app is closed } @Override protected void onNewIntent(@NonNull Intent intent) { super.onNewIntent(intent); MappSdkPlugin.handleIntent(this, intent); // add this call to handle rich push when app already running } }

In ApplicationManifest.xml declare launchMode for MainActivity as singleTop. This is mandatory to provide proper handling of a rich push messages in all application states (quit, background, foreground).

<activity android:name=".MainActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">

 

Geotargeting (Geofencing)

Android

Change MainActivity to extend FlutterFragmentActivity.

public class MainActivity extends FlutterFragmentActivity

 

Add locations and internet permissions in the AndroidManifest.xml file

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> <uses-permission android:name="android.permission.INTERNET"/>

Note: Geofencing is not available in initial plugin release. It’s available from version 0.0.5.

Related content