0

I am working on IonicApp 2 and I have a screen in which, when the user clicks the filed we wanted to show the calculator so that the user can perform the calculation.

Is there a way we could do it?

Regards, Raaj

Raajkumar
  • 857
  • 2
  • 13
  • 26

1 Answers1

0

Install plugins

ionic plugin add cordova-plugin-inappbrowser
ionic plugin add cordova-plugin-appavailability
ionic plugin add cordova-plugin-device

thank import them

import { InAppBrowser, AppAvailability, Device } from 'ionic-native';

now try this

launchExternalApp(iosSchemaName: string, androidPackageName: string, appUrl: string, httpUrl: string, username: string) {
    let app: string;
    if (Device.device.platform === 'iOS') {
        app = iosSchemaName;
    } else if (Device.device.platform === 'Android') {
        app = androidPackageName;
    } else {
        let browser = new InAppBrowser(httpUrl + username, '_system');
        return;
    }

    AppAvailability.check(app).then(
        (success) => { // success callback
            let browser = new InAppBrowser(appUrl + username, '_system');
        },
        (error) => { // error callback
            let browser = new InAppBrowser(httpUrl + username, '_system');
        }
    );
}

openInstagram(username: string) {
    this.launchExternalApp('instagram://', 'com.instagram.android', 'instagram://user?username=', 'https://www.instagram.com/', username);
}

openTwitter(username: string) {
    this.launchExternalApp('twitter://', 'com.twitter.android', 'twitter://user?screen_name=', 'https://twitter.com/', username);
}

openFacebook(username: string) {
    this.launchExternalApp('fb://', 'com.facebook.katana', 'fb://profile/', 'https://www.facebook.com/', username);
}
Nikhil
  • 417
  • 1
  • 6
  • 16