appsflyer-react-native-plugin icon indicating copy to clipboard operation
appsflyer-react-native-plugin copied to clipboard

add on new intent override plugin for expo android

Open f0wu5u opened this issue 1 year ago • 4 comments

In reaction to this issue https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/issues/558 and this closed PR https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/pull/559.

This adds the;

import android.content.intent

override fun onNewIntent(intent: Intent?) {
    super.onNewIntent(intent)
    setIntent(intent)
  }

by default if import android.content.intent is not already in MainActivity and if override fun onNewIntent(intent: Intent?) is not already implemented.

This ultimately resolves issue with expo android not opening deeplinks when app is in background

cc: @iway1

f0wu5u avatar Sep 18 '24 13:09 f0wu5u

why not merge?🚨🚨🚨🚨🚨🚨

erenkulaksiz avatar Jan 13 '25 09:01 erenkulaksiz

Please merge this.

jp1987 avatar Jan 27 '25 12:01 jp1987

I encountered the following error:

Task :app:compileDebugKotlin FAILED
e: file:///Users/saseungmin/workspace/essentory-app/android/app/src/main/java/com/essentory/app/MainActivity.kt:17:3 'onNewIntent' overrides nothing.
e: file:///Users/saseungmin/workspace/essentory-app/android/app/src/main/java/com/essentory/app/MainActivity.kt:18:23 Argument type mismatch: actual type is 'android.content.Intent?', but 'android.content.Intent' was expected.

Fixed by updating the code to:

import android.content.Intent

override fun onNewIntent(intent: Intent) {
  super.onNewIntent(intent)
  setIntent(intent)
}
  • Expo SDK 53, react-native v0.79.2 project

saseungmin avatar Jun 10 '25 01:06 saseungmin

We have also encountered the issue like @saseungmin, and the suggested fix solved this issue 👍 Running on Expo 52, react-native 0.76.9.

Changed both appearances of (intent: Intent?) to (intent: Intent).

This resolves the expo issue with Android not opening deeplinks when the app is in the background!

thalmann-christof avatar Jul 22 '25 14:07 thalmann-christof