$cordovaSocialSharing.canShareVia("instagram") not working in Android

So I have this

    $cordovaSocialSharing.canShareVia("instagram").then(function(result) {  
        console.log(result); console.log("good");
    }, function(err) {
        console.log(err); console.log("no good");
    });

On my iphone I have Instagram installed and I get “good”.

On my android device I’ve also installed Instagram, but I get “no good”. Also … err has the following contents

["com.android.mms", "com.samsung.android.app.memo", "com.google.android.talk", "com.google.android.apps.docs", "com.samsung.android.app.FileShareClient", "com.android.bluetooth", "com.android.email", "com.google.android.gm", "com.google.android.apps.docs", "com.facebook.katana", "com.facebook.orca"]

As you can see … no Instagram in the list, but I do have it installed on my device.

Some Ionic info :

Cordova CLI: 5.4.1
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.8.4 
ios-sim version: 5.0.6 
OS: Mac OS X El Capitan
Node Version: v5.4.1
Xcode version: Xcode 7.2.1 Build version 7C1002 

and the social sharing plugin

cordova-plugin-x-socialsharing 5.0.10 "SocialSharing"

Any help on this?

I’ve also tested this with the window.plugin notation.

the android version code must be some like this :

$cordovaSocialSharing.shareViaInstagram(message, image, function() {
console.log('share ok')}, function(errormsg){
alert("I'm sorry you should have instagram to share")})

i’ve tested in my android app

But this means it will try and send the message to IG … if not it fails right?

But I want to check before I can send … this way I can show an icon or not.

if you want to check the app installed or not, you can use cordovaAppAvaibility first and then you can show the icon.

wich ngcordova do you have? because

$cordovaSocialSharing.shareViaInstagram

does not exists

Well got it working like this

    var isIOS = ionic.Platform.isIOS();
    var isAndroid = ionic.Platform.isAndroid(); 


    if(isIOS) {
        $cordovaSocialSharing.canShareVia("instagram").then(function(result) {  
            $scope.canShareInstagram  = true; 
        }, function() {
            $scope.canShareInstagram  = false;
        });               
    } else {
       if(isAndroid) {
        $cordovaAppAvailability.check('com.instagram.android')
            .then(function() {
                $scope.canShareInstagram  = true;
            }, function () {
                $scope.canShareInstagram  = false;
            });            
       } 
    }