llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
176 stars 68 forks source link

Link isn't received by flutter after state restoration if android:launchMode = singleInstance #125

Closed miklcct closed 5 days ago

miklcct commented 1 month ago

Describe the bug

If I start the app using an URL intent, and start it again using another URL intent after it is frozen, the second intent can't be received in Flutter if android:launchMode = singleInstance in AndroidManifest.xml.

Does it related to

[ ] App Links (Android)
[x] Deep Links (Android)
[ ] Universal Links (iOS)
[ ] or Custom URL schemes? (iOS)

Does the example project work?

[ ] Yes
[x] No
[ ] Irrelevant here

Did you fully read the instructions for the targeted platform before submitting this issue?

Modified example repo has been published at https://github.com/miklcct/app_links_bug

[ ] Yes
[ ] No
[x] Irrelevant here

Screen_recording_20240524_170631.webm

Related logcat entries are below:

2024-05-24 17:10:24.136 21477-21477 com.llfbandit.app_links app.aubin                            D  Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=geo: flg=0x17000000 cmp=app.aubin/.MainActivity (has extras) }
2024-05-24 17:10:24.136 21477-21477 com.llfbandit.app_links app.aubin                            D  Handled intent: action: android.intent.action.VIEW / data: geo:51.520199,-0.104861
2024-05-24 17:10:25.481 21477-21528 flutter                 app.aubin                            I  Received geo:51.520199,-0.104861 from one-time stream
2024-05-24 17:10:25.590 21477-21528 flutter                 app.aubin                            I  Handling URI geo:51.520199,-0.104861
2024-05-24 17:10:39.101 21477-21477 com.llfbandit.app_links app.aubin                            D  Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=geo: flg=0x17000000 cmp=app.aubin/.MainActivity (has extras) }
2024-05-24 17:10:39.101 21477-21477 com.llfbandit.app_links app.aubin                            D  Handled intent: action: android.intent.action.VIEW / data: geo:51.520199,-0.104861
2024-05-24 17:10:39.132 21477-21477 com.llfbandit.app_links app.aubin                            D  Intent { act=android.intent.action.VIEW dat=geo: flg=0x13400000 cmp=app.aubin/.MainActivity (has extras) }
2024-05-24 17:10:39.132 21477-21477 com.llfbandit.app_links app.aubin                            D  Handled intent: action: android.intent.action.VIEW / data: geo:0,0?q=211%20Cricklewood%20Broadway%2C%20London%20NW2%203HS%2C%20UK
2024-05-24 17:10:39.619 21477-22421 flutter                 app.aubin                            I  Adding uri geo:51.520199,-0.104861 into one-time stream
2024-05-24 17:10:40.469 21477-22421 flutter                 app.aubin                            I  Received geo:51.520199,-0.104861 from one-time stream
2024-05-24 17:10:40.620 21477-22421 flutter                 app.aubin                            I  Handling URI geo:51.520199,-0.104861
llfbandit commented 5 days ago

You should use stringLinkStream instead of uriLinkStream. On reworked package example with singleInstance launch mode and stringLinkStream it worked fine. If there's an issue, it is related to Uri.parse method.

From here, this is not related to the package.