avioli / uni_links

Flutter plugin for accepting incoming links.
BSD 2-Clause "Simplified" License
563 stars 288 forks source link

linkStream.listen() not working for Android phones #147

Open MarkoKrstanovicBM opened 2 years ago

MarkoKrstanovicBM commented 2 years ago

I'm using AppLinks for Android with https scheme and deeplinking is working fine. The issue that I have is with linkStream.listen(String link) method. It never gets called. For iOS everything works fine, deeplinking opens the app and the listener is activated, but for Android deeplinking opens the app and nothing happens listener is not activated.

I am using Samsung Galaxy S21 Ultra (Android 12) and some other Samsung phones with older versions of Android OS.


  _subscription = linkStream.listen((String link) {
     // some code here
    }, onError: (err) {
      print(err);
      // Handle exception by warning the user their action did not succeed
    }, onDone: () {
    // some code here
    });```
weilaimg commented 2 years ago

Same issue here. Did you find any solutions?

weilaimg commented 2 years ago

I'm using AppLinks for Android with https scheme and deeplinking is working fine. The issue that I have is with linkStream.listen(String link) method. It never gets called. For iOS everything works fine, deeplinking opens the app and the listener is activated, but for Android deeplinking opens the app and nothing happens listener is not activated.

I am using Samsung Galaxy S21 Ultra (Android 12) and some other Samsung phones with older versions of Android OS.

  _subscription = linkStream.listen((String link) {
     // some code here
    }, onError: (err) {
      print(err);
      // Handle exception by warning the user their action did not succeed
    }, onDone: () {
    // some code here
    });```

Hi Marko

I found the solution: https://github.com/avioli/uni_links/issues/119#issuecomment-864503324

It really helps me. Hope you are doing well.

vicdotdevelop commented 2 years ago

Same Problem here +1 - worked fine for a year now does not do anything anymore

vicdotdevelop commented 2 years ago

@weilaimg do you have a code snippet? For me trying out alle the launchmode values did worked. I used it for oauth with the flutter oauth2 library with system browser. The app opens up again afterwards but the listener doesnt catch up

KosarMitha commented 2 years ago

Hello, I was facing this issue since 7 days , I tried all Firebase Dynamic Links, uni_links both of them were running on either one of device ( Dynamic links on android, and uni_links on iOS) so I finally tried this small hack where I installed both libraries and checked based on platform inside initState() if (Platform.isIOS) { _handleIncomingLinks(); _handleInitialUri(); } else { _dynamicLinkService.retrieveDynamicLink(context); }