0

I'm doing a dapp working with Wallet Connect package, when user wants to connect with some wallet but on mobile device that wallet app is not installed, how to redirect user using deep links to the app store / play store to install wallet app?

1 Answers1

0

You could utilise the https://pub.dev/packages/url_launcher(url_launcher) package to interact with the platform-specific methods UIApplication.open() (iOS) and startActivity() (Android).

They are designed in such a way that specific url schemes can open system apps, like the AppStore and PlayStore.

You would additionally need to distinguish between the iOS and Android case so that the correct url format is being used.

import 'dart:io' show Platform;
import 'package:url_launcher/url_launcher.dart';

if (Platform.isAndroid) {
    var appName = "<your_app_name>"
    var targetURL = Uri.parse("market://details?id=$appname");
    await launchUrl(_url);
} else if (Platform.isIm OS) {
    var appID = "<your_app_id>"
    var targetURL = Uri.parse("itms-apps://itunes.apple.com/app/$appID");
    await launchUrl(_url);
}

For more information on the platform specific see this iOS question and this Android question.

jraufeisen
  • 3,005
  • 7
  • 27
  • 43