How to open already installed app on click of button?

Hi all,
I want to open another play store app which is already installed in the mobile on click of link or button from my app using angular JS and ionic framework. can anyone give solution ?
Thanks in advance.

Thank you for your time @thesourav.
I installed using the command cordova plugin add com.lampa.startapp.
I am not getting how to use this plugin inside controller. Do i need to drag any js file on index.html or need to use any provider in controller?
Without doing any of these things how controller will recognize startApp key word?

The js file is downloaded and placed in your platform_www folder under platforms. The service returns a simple Javascript object.No angular directies are used. You can use it directly

Hi @thesourav
I downloaded that plugin using command cordova plugin add com.lampa.startapp.
and i just placed this code which i got from Open external app link on click of button as like below

    var sApp = startApp.set({
        "package": "com.apppackage.name"
    });

    // check app for exists
    sApp.check(function (values) {
        sApp.start();
    }, function (error) { // not exists, open play market
        startApp.set({
            "action": "ACTION_VIEW",
            "uri": "market://details?id=com.apppackage.name"
        }).start();
    });

It worked out for me. But this is only for Android. Iam looking for ios now.

It should work for iOS as well.( Havent tried it though)
You have to create an URL scheme for your app(https://github.com/EddyVerbruggen/Custom-URL-scheme) and pass that in your method.

Hi @thesourav @vishwaprasad123

Im trying this particular answer. I’ve added the com.lampa.startapp plugin and used the same code.
But I get Cannot find name 'startApp’ this error.
How to import startApp in the .ts file and app.module.ts file?
Can you help me? Thanks in advance.!

I did this in ionic 1. It will work fine.

Hi @vishwaprasad123 How to import startApp in .ts file.?
Can you share your .ts file where you used this code.
What we have to add in the header for startApp?

@Raja45 In ionic 1 only .js. No .ts files. you are trying for Ionic 2+ i guess. If i get any solution i will share.

@vishwaprasad123 Thank you. Did you import anything in the header of .js file?
Can you share your Ionic 1 .js code if possible?

I just added below plugin and directly used below code without declaring startApp anywhere. It worked for me.

  var sApp = startApp.set({
      "package": "com.package.name"
  });

  // check app for exists
  sApp.check(function (values) {
      sApp.start();
  }, function (error) { // not exists, open play market
      startApp.set({
          "action": "ACTION_VIEW",
          "uri": "market://details?id=com.package.name"
      }).start();
  });

This is only for android. IOS not done

@Raja45 For ionic 2+ , use this