add on new intent override plugin for expo android
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
why not merge?🚨🚨🚨🚨🚨🚨
Please merge this.
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
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!