EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 907 forks source link

canShareVia(“instagram”) not working in Android #527

Open fransyozef opened 8 years ago

fransyozef commented 8 years ago

Hi I'm using ngCordova with Ionic, but I've also tested the code with the normal window.plugin

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?

EddyVerbruggen commented 8 years ago

I'm no Instagram user, but can you share text-only? Perhaps try also adding an image like so and see if it makes a difference:

$cordovaSocialSharing
    .canShareVia(socialType, message, image, link)
    .then(function(result) {
      // Success!
    }, function(err) {
      // An error occurred. Show a message to the user
    });
gregavola commented 8 years ago

I'm also seeing this problem, however as a workaround - you just run the shareVia - and it typically fails if they don't have the app.

EddyVerbruggen commented 8 years ago

What @gregavola describes can happen on iOS in case you didn't whitelist the instagram URL scheme in the .plist but I can't really explain why this behaves as you describe on Android :question:

darpanvithani commented 8 years ago

@EddyVerbruggen I was getting same error and It was solved by using your code. But my image is not posted in Instagram. Values I used are below. socialType ="instagram", message="test", image="byte code of image here", link ="link of sample image"

$cordovaSocialSharing .canShareVia("instagram", "#notreallystrangers", $rootScope.imagecode,"https://www.google.nl/images/srpr/logo4w.png")

Can you please help me?

fiznool commented 7 years ago

Initially I also had this issue but solved it by calling canShareVia with an image URL. Using canShareVia('instagram') will not work, you need to use canShareVia('instagram', null, null, '/path/to/image').

The reason is that instagram only registers itself as a share intent on Android if you are trying to share an image. If you go to a web page in Chrome for Android and use the share button, you'll see that Instagram isn't listed, this is because Instagram doesn't register as a share handler for a link, only for images.