Flutter Plugin Migration Guides

Android

Migrating to Version 1.0.7 and above

The ENGAGE Flutter Plugin for Android is updated to include the auto-initialization of SDK instead of manually handling it.

This will require a couple minor changes in apps previously using Flutter version 1.0.6.

1. Remove Work Manager Setup

Since the auto-initialization is happening in Android now, so no need to provide the configuration in the AndroidManifest.xml file. Remove the below code from the AndroidManifest.xml.

<manifest xmlns:android = “http://schemas.android.com/apk/res/android”
xmlns:tools = “http://schemas.android.com/tools”> 

<application

android:label="testApp"
       android:name=".MyApplication"
       android:icon="@mipmap/ic_launcher">
 	.....
      ..... <!-- other code –--->
        .....
  
      <!-- Remove Provider Block-->
			<!--- Start --->
       <provider
           android:name="androidx.startup.InitializationProvider"
           android:authorities="${applicationId}.androidx-startup"
           android:exported="false"
           tools:node="merge" >
      
           <meta-data
               android:name="com.firstorion.engage.core.EngageInitProvider"
               android:value="androidx.startup"
               tools:node="remove" />
       </provider>
			<!--- End ---> 

</application>
</mainfest>


2. Remove ENGAGE SDK Initialization from Android Application Class

Since the auto-initialization is in place, there is no need to initialize the ENGAGE SDK in Application Class.

import com.firstorion.engage.core.EngageApp
import com.firstorion.engage.core.IEngageLoggingInterceptor
import android.app.Application
import android.util.Log

class MyApplication : Application(), IEngageLoggingInterceptor {
    
  override fun onCreate() {
        super.onCreate()
       
        //Remove Initialization for ENGAGE SDK --> Remove below code////
        EngageApp.initializeEngageForFlutterFirebase(this)
	    	////////////////////////////////////////////
    

        // logging interceptpr 
        EngageApp.Settings.setLoggingInterceptor(this)
    }
  
    override fun intercept(message: String, level: Int) {
        println("engage.app  $message" )
    }
  
}

3. Configure Firebase

Refer the ENGAGE Flutter Firebase configuration section as per the Host App setup. Link.


iOS

Migrating to Version 2.0.0 and above

1. Change in .netrc file for SDK configuration

Change the credentials in .netrc file to point to Bitbucket repository instead of Jfrog.

Before

machine firstorion.jfrog.io
login <USERNAME>
password <PASSWORD>

After

machine bitbucket.org
login <YOUR_BITBUCKET_USERNAME>
password <YOUR_APP_PASSWORD>

2. Modify the pod file (if using cocoapods option)

In your Podfile, make sure to add ENGAGE SDK dependencies as shown below:

platform :ios, '14.0'
use_frameworks!
use_modular_headers!

target 'Runner' do
  pod 'EngageKit', :git => 'https://bitbucket.org/fopartner/engagesdk_ios.git', :tag => '4.3.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

target 'RunnerNSE' do
  pod 'EngageKit', :git => 'https://bitbucket.org/fopartner/engagesdk_ios.git', :tag => '4.3.0'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        'PERMISSION_CONTACTS=1',
        'PERMISSION_NOTIFICATIONS=1',
      ]
    end
  end
end