Get intent data string on every app start also with com.google.firebase.MessagingUnityPlayerActivity

Hello,

I´m struggling with the following problem. I open my Unity Android App with an intent from a link. Everything works fine. But I also would like to get the intent data string to redirect to correct screen in my App. I get the intent data string only on first start of the app. If I pause the app and resume with the link, the intent data string wont be updated. Following is the code of the intent filter in the android manifest. I can´t change the activity to com.unity3d.player.UnityPlayerActivity because of known issues when receiving notification data payloads in the background.

<activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <intent-filter>
        <action android:name="android.intent.action.VIEW"></action>
        <category android:name="android.intent.category.DEFAULT"></category>
        <category android:name="android.intent.category.BROWSABLE"></category>
        <data
        android:host="com.urltoopen.app"
        android:scheme="https"></data>
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>

In Unity I try to get the intent data string with following code:

AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); 
//AndroidJavaClass jc = new AndroidJavaClass("com.google.firebase.MessagingUnityPlayerActivity");
AndroidJavaObject context = jc.GetStatic<AndroidJavaObject>("currentActivity");       
AndroidJavaObject intent = context.Call<AndroidJavaObject>("getIntent");
Debug.Log($"Intent data string: {intent.Call<string>("getDataString")}");

If I try to get the intent with the class com.google.firebase.MessagingUnityPlayerActivity as shown in line two I´ll get the error: there is no field “currentActivity” …

I´ll get the intent data string on the first start of the app. But not when resuming the app from background. Is there any other solution to get the intent data string on every start of the app?
I´m looking forward to any suggestion, thanks a lot.

Hey did you ever find a solution to this? I’m having the same issue.

No sorry, I didn´t found a good solution yet.