I looked at related SO but they didn't seem to resolve this issue.
The app supports app linking and website has .well-known/assetlinks.json.
When clicking app link in email, say https://staging.xyz.com/v3/info/7vwD2yjW, the
- main activity should appear
- onCreate() should get URI data from intent.data
- main activity should update itself based on URI data
Launching app from a cold start with a valid app link, the intent.data is always null. However if app had been running or in background, URI intent.data is not null in onNewIntent() and works fine.
Not sure what I am missing. It's running on a Galaxy J3 Prime, Android 7.0. Here is the config. Any ideas how to get intent.data URI from cold start?
<activity
android:name=".activity.MainActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait">
<tools:validation testUrl="https://staging.xyz.com/v3/info/7vwD2yjW" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="xyz.com"
android:pathPattern="/.*/share" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="xyz.com"
android:pathPattern="/.*/info/.*" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="*.xyz.com"
android:pathPattern="/.*/share" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="*.xyz.com"
android:pathPattern="/.*/info/.*" />
</intent-filter>