adjust / flutter_sdk

This is the Flutter SDK of
MIT License
59 stars 49 forks source link

How to navigate based on standard deep link? #82

Closed Hassanmohsaid closed 2 years ago

Hassanmohsaid commented 2 years ago

Is there any way I can navigate the user inside my flutter app based on the deep link?

I know standard deep links are not detected by dart code, they are detected in onNewIntent in Android for example, how can I send this link back to dart for Android & iOS as well?

namini40 commented 2 years ago

you can use uni_links package

import 'dart:async';
import 'dart:io';

import 'package:uni_links/uni_links.dart';
import 'package:flutter/services.dart' show PlatformException;

// ...

  Future<void> initUniLinks() async {
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      final initialLink = await getInitialLink();
      // Parse the link and warn the user, if it is not correct,
      // but keep in mind it could be `null`.
    } on PlatformException {
      // Handle exception by warning the user their action did not succeed
      // return?
    }
  }

// ...
uerceg commented 2 years ago

@namini40 Thanks for suggestion. Probably easiest way for you to obtain value of deep link which has opened your app is if you use the plugin which is already out there and this uni_links looks like a pretty reputable and often used one. 👍