uni_links icon indicating copy to clipboard operation
uni_links copied to clipboard

Initial Uri works, but listening to changes doesn't

Open igorcafe opened this issue 2 years ago • 1 comments

I'm using custom scheme and am testing on my Android Emulator, which is running Android 9.

The getInitialUri is working as expected, but with uriLinkStream.listen nothing happens (no uri nor error). Which is strange because clicking on a link like that moves me to my app:

https://user-images.githubusercontent.com/85039990/211621098-7f494312-973b-4585-a2d6-b2c1689a059a.mp4

AndroidManifest.xml:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <!-- Accepts URIs that begin with abc://app.blabla.com -->
  <data
    android:scheme="[abc]"
    android:host="[app.blabla.com]" />
</intent-filter>

My initialization:

StreamSubscription? linkSubscription;
...
Future initUniLinks() async {  
  try {
    final uri = await getInitialUri();
    print("uri: $uri");
  
    linkSubscription = uriLinkStream.listen((Uri? uri) {
      print("uri: $uri");
    }, onError: (err) {
      print(err);
    });
  } on PlatformException {
    print("error!");
  }
}

igorcafe avatar Jan 10 '23 17:01 igorcafe

Probably related to #162

igorcafe avatar Jan 10 '23 19:01 igorcafe