MessagingUnityPlayerActivity breaks Unity's Application.deepLinkActivated callback
Please fill in the following fields: Unity editor version: 2019.3.10f1 Firebase Unity SDK version: FirebaseMessaging_version-6.13.0 Source you installed the SDK: .unitypackage FirebaseAnalytics.unitypackage: Dotnet4 Firebase plugins in use (Auth, Database, etc.): FirebaseMessaging_version-6.13.0 Additional SDKs you are using: Just Unity stuff, UnityAds etc Platform you are using the Unity editor: Mac Platform you are targeting (iOS, Android, and/or desktop): Android, iOS, issue only on Android Scripting Runtime (Mono, and/or IL2CPP): IL2CPP for iOS/Android
Please describe the issue here: When using the MessagingUnityPlayerActivity on android the deeplink callback provided by unity no longer works when the app is resumed.
Application.deepLinkActivated
Application.absoluteURL works on app launch, but not on app resume.
Not changing anything else except the activity back to com.unity3d.player.UnityPlayerActivity in the manifest makes it work again so I suspect there's something missing in the MessagingUnityPlayerActivity which needs to be there to support deeplinks.
Note that deep links do successfully launch the app but the link is not delivered to Unity once it's started when using the MessagingUnityPlayerActivity.
Extra Questions: Have I tried importing the package again? Yes Have I tried building without the SDK? Yes and it works perfectly fine Have I tried reimport all? Yes Have I tried relaunching Unity? Yes Do I have both iOS and Android modules installed? Yes
What's the issue repro rate? 100%
This issue does not seem to follow the issue template. Make sure you provide all the required information.
Hi,
I'm having the exact same issue on the 6.14.1 version, this is a really quick fix on the MessagingUnityPlayerActivity you just need to call setIntent even when the intent doesn't have any extras, thus making sure that the UnityPlayerActivity has access to the Intent. Or simply call the super.onNewIntent method. As is, the class disables the chances of intents not supported by firabase to be correctly processed.
For anyone in the future having this issue, you can just extend the MessagingUnityPlayerActivity and add the setIntent manually, its a pain but at least it works as one would expect:
public class UniversalDeepLinkingActivity extends com.google.firebase.MessagingUnityPlayerActivity {
@Override
protected void onNewIntent(Intent intent)
{
this.setIntent(intent);
super.onNewIntent(intent);
}
Just place the activity on your unity project and replace the MessagingUnityPlayerActivity to UniversalDeepLinkingActivity on the AndroidManifest.
Tested and included this on my Universal Deep Linking plugin. For the regular unity deepLinkActivated event I'm pretty sure they use the same approach as I did on my plugin so the above fix should also work.
This seems to be a bug.
I'll forward this issue to the team and will let you know once the fix is ready.
UniversalDeepLinkingActivity @DVDPT proposed looks like an appropriate workaround for the time being.