Skip to content

Migration guides

Davor Komušanac edited this page Dec 5, 2022 · 15 revisions

Migration from 6.1.0 to 6.2.0, in case you are getting rid of use_frameworks! in the Podfile

Starting from the 6.2.0 plugin version it's not mandatory to have use_frameworks! in the Podfile. If you want to get rid of use_frameworks! you need to :

  1. Remove use_frameworks! from the Podfile, then from the ios folder call pod deintegrate & pod update.
  2. Perform mmine integrate command from the guide about Notification Extension Integration
  3. Make cleanup from the xCode Product->Clean Build Folder and remove Derived Data rm -rf ~/Library/Developer/Xcode/DerivedData/*

Notice:

Manual plugin integration for iOS is deprecated, because plugin can be integrated without use_frameworks!. If you have used Manual integration before, you need to follow the recommendations of how to return back to automatic integration and then Setup xcode project for Notification Extension.

Migration from 5.x to 6.x

Starting from 6.0.0 version we updated react-native to 0.68.0. However New react-native architecture features aren't supported yet, so for Android platform in newArchEnabled=false should be set into gradle.properties, and the flag RCT_NEW_ARCH_ENABLED shouldn't be set for iOS platform. To migrate application you can use react-native upgrade helper or just re-create application from scratch using particular react-native version (react-native init newproject --version 0.68.0).

Changes for Android platform

We've migrated Android MobileMessaging SDK used within the plugin to AndroidX, changed com.google.firebase:firebase-messaging to 22.0.0 version which has some breaking changes, changed com.google.android.gms:play-services-location version to 18.0.0.

Changes in Android SDK versions:

  • compileSdkVersion was changed from 29 to 31
  • targetSdkVersion was changed from 29 to 31

Changes in registering for push notifications in Firebase:

Please check Registration for push notifications in Firebase documentation

Security improvements

Starting from 6.0.0 version we removed deprecated ECB cryptor from our Android MobileMessaging SDK, so if you have installations of the application with MobileMessaging plugin version < 3.0.0 (it actually means that data encrypted with old algorithm needs to be migrated), add withCryptorMigration = true into android/build.gradle extra properties:

buildscript {
    ext {
        ...
        withCryptorMigration = true
    }

Additionally you can check how it's set in Example app.

Geofencing changes

Additionally following permissions will be added automatically to the AndroidManifest.xml:

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

In case you aren't using geo, you can add it to the /android/app/src/main/AndroidManifest.xml so permissions won't be requested:

<manifest ... xmlns:tools="http://schemas.android.com/tools">
    ...    
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove"  />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove"  />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove"  />
    ...
</manifest>

Procedure of requesting permissions changed, please check Geofencing guide for Android.

Migration from 4.x to 5.x

Starting from 5.0.0 version we updated react-native to 0.66.3. To migrate application you can use react-native upgrade helper or just re-create application from scratch using particular react-native version (react-native init newproject --version 0.66.3).

Deprecations:

  • register(eventName, handler) is deprecated, for react-native version >= 0.65 subscribe(eventName, handler) : EmitterSubscription should be used.
  • unregister(eventName, handler) is deprecated, for react-native version >= 0.65 unsubscribe(subscription) should be used.
  componentDidMount() {
-      mobileMessaging.register(event, this.handleMobileMessagingEvent);
+      this.subscription = mobileMessaging.subscribe("notificationTapped", this.handleMobileMessagingEvent);
  }

  componentWillUnmount() {
-      mobileMessaging.unregister(event, this.handleMobileMessagingEvent);
+      mobileMessaging.unsubscribe(this.subscription);
  }

Migration from 3.x to 4.x

Starting from 4.0.0 version we updated react-native to 0.64.2. To migrate application you can use react-native upgrade helper or just re-create application from scratch using particular react-native version (react-native init newproject --version 0.64.2).

You may face cycle in dependencies between targets '<Your main target>' and 'FBReactNativeSpec' error while building project for iOS, it's known react-native issue, we solved it for our Example project by adding following to Podfile:

target 'Example' do
  ...
  post_install do |installer|
    react_native_post_install(installer)
    
    #fix for issue https://github.com/facebook/react-native/issues/31034
    installer.pods_project.targets.each do |target|
        if (target.name&.eql?('FBReactNativeSpec'))
          target.build_phases.each do |build_phase|
            if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
              target.build_phases.move(build_phase, 0)
            end
          end
        end
      end
    #end of fix

  end
end
Clone this wiki locally