app-launcher-android-ios

1.0.1 • Public • Published

설치

npm i app-launcher-android-ios

사용법

    import * as launcher from 'app-launcher-android-ios';

    launchExternalApp(iosSchemaName: string, androidPackageName: string, httpUrl: string, 
                        httpUrliOS: string, httpUrlAndroid: string) {
        let app: string;

        if (this.isIos()) {
            app = iosSchemaName;
        } else if (this.isAndroid()) {
            app = androidPackageName;
        } else {
            // 일반 브라우져로 open
            // this.iab.create(httpUrl);
            return;
        }

        this.appAvailability.check(app).then(
            () => {
                // 앱 실행
                if (this.isIos()) {
                    launcher.uriLaunch(app);
                }
                else if (this.isAndroid()) {
                    launcher.packageLaunch(app);
                }
            },
            () => {
                // 앱이 없으면 마켓으로 이동
                if (this.isIos()) {
                    this.iab.create(httpUrliOS);
                }
                else if (this.isAndroid()) {
                    this.iab.create(httpUrlAndroid, '_system');
                }
            }
        );
    }

참고

Readme

Keywords

none

Package Sidebar

Install

npm i app-launcher-android-ios

Weekly Downloads

3

Version

1.0.1

License

ISC

Unpacked Size

2.43 kB

Total Files

3

Last publish

Collaborators

  • stove99