1.0.1 • Published 5 years ago

app-launcher-android-ios v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

설치

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');
                }
            }
        );
    }

참고

1.0.1

5 years ago

1.0.0

5 years ago