/app-deep-link

App deep link, based on scheme and universal link. Wake up if installed, otherwise, guide to download. (如果已经安装app,js调起app,否则引导下载)

Primary LanguageJavaScript

App deep link for Android and iOS

https://img.shields.io/npm/v/app-deep-link/latest.svg https://img.shields.io/badge/%24-donate-ff69b4.svg

Introduction

When a clicked link or programmatic request invokes a web URI intent, the mobile system tries open the only available app that can handle the URI. If open the app fails, navigate to download it.

You needn't consider what platform is Android or iOS. You don't even need to consider what browser it is.

Call the only method AppDeepLink.wakeUpOrInstall when you want to wake up your app or install it in your js.

(当点击链接时,如果已经安装了app,尝试调起app,如果没有安装app,跳转到下载)

Getting started

1. npm

Install dependency

$ npm install -S app-deep-link

Basic Useage

const AppDeepLink = require('AppDeepLink');

...
AppDeepLink.wakeUpOrInstall({
    ios: {
        ulink: 'https://your.universal.link',

        scheme: 'yourscheme://your.scheme',

        downloadUrl: 'https://your.download.url'
        // itms-apps://itunes.apple.com/app/id
        // itms-appss://apps.apple.com/app/id
        // https://apps.apple.com/app/id
        // https://baidu.com/app.plist
    },
    android: {
        scheme: 'yourscheme://your.scheme', 

        downloadUrl: 'https://baidu.com/your_app.apk'
    }
});
...

2. script

Add dependency

<script src="../dist/app_deep_link.js"></script>

Basic Useage

...

AppDeepLink.wakeUpOrInstall({
    ios: {
        ulink: 'https://your.universal.link',

        scheme: 'yourscheme://your.scheme',

        downloadUrl: 'https://your.download.url'
        // itms-apps://itunes.apple.com/app/id
        // itms-appss://apps.apple.com/app/id
        // https://apps.apple.com/app/id
        // https://baidu.com/app.plist
    },
    android: {
        scheme: 'yourscheme://your.scheme', 

        downloadUrl: 'https://baidu.com/your_app.apk'
    }
});
...

Build

$ npm run build

Donate

If you find this project useful, you can buy anthor a glass of juice. Thank you.

Donate

Paypal Me

Questions

For help and support questions, please mail to me. (huzhenjie.dev@gmail.com)