1

I use lampa.startapp cordova plugin to know if apps are installed and to launch external apps on a device running my app (see: com.lampa.startapp).

navigator.startApp.check("com.application.name", function(message) { /* success */
    console.log(message); // => OK
}, 
function(error) { /* error */
    console.log(error);
});

But I need to know the version of another app installed on a device (not the current one) and this plugin does not seem to do this.

For example : I installed "myApp" Cordova app on a device. In these app, i want to check if "twitter" app is installed and if yes get "Twitter" version.

Does anyone know a method to get this app version?

kenorb
  • 155,785
  • 88
  • 678
  • 743
Geoffrey Lalloué
  • 1,456
  • 1
  • 20
  • 43

2 Answers2

1

To check if app is installed use AppAvailability plugin.

This plugin allows you to check if an app is installed on the user's device.

But it doesn't return app version, just whether it is installed or not.

To get application version you will probably need to write your own PhoneGap plugin.

There is also Cordova AppVersion plugin, but it only reads the version of your current app from the target build settings.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Glogo
  • 2,694
  • 2
  • 23
  • 23
  • Thanks but this plugin read the version of "my" app from the target build settings, and i want to read the version of an app installed on the same device my app – Geoffrey Lalloué May 19 '15 at 13:31
  • I updated answer. Sorry I misunderstood your question - thought you wanted your current app version – Glogo May 19 '15 at 14:22
  • Thanks for your answer. I tried "AppAvailability" plugin too but it can be only used to check if app is installed as "lampa.startapp" plugin do. But no one return app version. – Geoffrey Lalloué May 19 '15 at 14:48
  • yea sorry didnt found plugin doing that, probably you will need to write your own cordova plugin - but it isnt that hard – Glogo May 19 '15 at 14:49
1

I found that if you install the plugin directly from the GitHub repo:

ionic cordova plugin add https://github.com/ohh2ahh/AppAvailability.git --save

the response to check() will come back with a JSON object that has the version information for that application you are checking on, instead of just a boolean that says whether it's there or not.

But you have to install it from the GitHub link, the npm link to the plugin doesn't appear to have that update to it.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ryanopolis
  • 43
  • 1
  • 7