Code Monkey home page Code Monkey logo

instagramplugin's Introduction

Instagram plugin for Cordova

By Vlad Stirbu.

Adds ability to share the content of a canvas element or a dataUrl encoded image using the Instagram application for iOS and Android.

GitHub version Join the chat at https://gitter.im/vstirbu/InstagramPlugin

Installing the plugin to your project

If you use cordova-cli newer than 5.0:

cordova plugin add cordova-instagram-plugin

or, for older versions:

cordova plugin add https://github.com/vstirbu/InstagramPlugin

Instagram plugin JavaScript API

Detect if the Instagram application is installed on the device. The function isInstalled accepts a callback function as parameter:

Instagram.isInstalled(function (err, installed) {
    if (installed) {
        console.log("Instagram is", installed); // installed app version on Android
    } else {
        console.log("Instagram is not installed");
    }
});

Share the content of a canvas element or a base64 dataURL png image. The function share accepts a string, corresponding to the canvas element id or the dataURL, an optional caption, and a callback function as parameters:

API CHANGE NOTE: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption.

Instagram.share(canvasIdOrDataUrl, caption, function (err) {
    if (err) {
        console.log("not shared");
    } else {
        console.log("shared");
    }
});

or:

Instagram.share(canvasIdOrDataUrl, function (err) {
    if (err) {
        console.log("not shared");
    } else {
        console.log("shared");
    }
});

Share library asset image or video. The function shareAsset (iOS only) accepts a string with asset local identifier, and a callback function as parameters:

var assetLocalIdentifier = "24320B60-1F52-46AC-BE4C-1202F02B9D00/L0/001";
Instagram.shareAsset(function(result) {
            console.log('Instagram.shareAsset success: ' + result);
        }, function(e) {
            console.log('Instagram.shareAsset error: ' + e);
        }, assetLocalIdentifier);

You can get a LocalIdentifier by using Photos Framework Fetching Assets API

A very basic application that uses the plugin can be found here.

Additionally for IOS only, you can utilize a fourth parameter on the base64/canvas method share, to correspond with a mode:

console.log(Instagram.SHARE_MODES);
> {
    DEFAULT: 0, // original plugin logistics, where it checks for IOS Version 13+ to switch from IG to IGO mode. 
    IGO: 1, // legacy UTI for instagram DI  (.exclusivegram)
    IG: 2,  // new UTI for instagram DI  (.photo)
    LIBRARY: 3 // save base64 or canvas to disk jpg, copy it to the Library, so that it can then be shared via App Intent
}

Using above as definition, you can change your code as such (note the usage of a blank caption, to specify 4 total arguments, not 3):

var caption = ''; // copied to clipboard by Cordova js. Instagram doesn't support feeding it anymore. 
Instagram.share(canvasIdOrDataUrl, caption, function (err) {
    if (err) {
        console.log("not shared");
    } else {
        console.log("shared");
    }
}, Instagram.SHARE_MODES.LIBRARY);

AngularJS/Ionic

The plugin is included in ngCordova and ionic-native.

NOTE: If you are using an image from the server,then you should download the image and fetch the content using readAsDataURL. Example:

var url = encodeURI('https://static.pexels.com/photos/33109/fall-autumn-red-season.jpg');
var filename = 'image.jpg';
var targetPath = cordova.file.externalRootDirectory + filename;
$cordovaFileTransfer.download(url, targetPath, {}, true).then(function(result) {
        var mywallpaper = result.toURL();
        window.resolveLocalFileSystemURL(mywallpaper, function(fileEntry) {
            fileEntry.file(function(file) {
                var reader = new FileReader(),
                    data = null;
                reader.onloadend = function(event) {
                    data = reader.result;
                    $cordovaInstagram.share(data, '#amazing').then(function(success) {
                        console.log('shareViaInstagram Success', success);
                    }, function(err) {
                        console.log('shareViaInstagram failed', err);
                    });
                };
                reader.readAsDataURL(file)
            });
        });
    },
    function(error) {},
    function(progress) {
});

Quirks:

Android

  • Passing caption in addition to sharing image requires Instagram Android application version 6.1.0 or higher.
  • Older versions of Android (2.x-3.x) do not have proper support for toDataURL on canvas elements. You can still get the canvas content as dataURL following these instructions. Pass the dataUrl instead of the canvas id to share.

iOS

  • Although the plugin follows the instructions to show only Instagram in the document interaction controller, there are reports that other apps appear in the list.

Recipes

  • Sharing image when knowing the file url.

License

The plugin is available under MIT license.

instagramplugin's People

Contributors

albertleao avatar bartburkhardt avatar bitdeli-chef avatar ensemblebd avatar funkjedi avatar mepc36 avatar mpk2 avatar muhsin-k avatar peterpeterparker avatar purplecabbage avatar rodrigograca31 avatar sfrdmn avatar sky-code avatar techwizeric avatar vstirbu avatar waffle-with-pears avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instagramplugin's Issues

Warning: Attempt to present on whose view is not in the window hierarchy

Hi

I'm trying to use Instagram plugin on IAB (i mean i'm trying to use it on a window that i opened with window.open)

When i try to share on Android it's working without any problem.

But when i try to make a share on iOS (on latest version) i got this error:

    Warning: Attempt to present <_UIDocumentActivityViewController: 0x13700c600> on <MainViewController: 0x136540fd0> whose view is not in the window hierarchy!

and nothing opened (share menu didn't open)

When i debug it, i saw that it's getting the error on this line:

    [self.interactionController presentOpenInMenuFromRect:CGRectZero inView:self.webView animated:YES];

What should i need to do for make it work?

Thanks

Share Caption on Android

Hey @vstirbu, thanks for this amazing plugin! Would you mind explaining the cause of why sharing captions on Android doesn't work? Would love to take a crack at fixing it. Thanks!

Share instagram on iPad

Hi, i am developing a ionic app and your plugin seems great!
I installed instagram on my iPad, and when attempting to share a photo, this is what i get on Xcode:

2016-08-08 12:36:06.231 HelloCordova[1188:339409] THREAD WARNING: ['Instagram'] took '1335.712158' ms. Plugin should use a background thread.

Any idea?

Thanks in advance for your help.

problem in native side in android

File parentDir = this.webView.getContext().getExternalFilesDir(null);
in this line parentDir is going to be null.
why????
plzzzz help me to resolve this error

how i can do that with vedio??

hello how are u ??

its possible to do that with vedio? (mp4 ) ??

please just tell me

I'm trying to do that but i cannt

thank u for great plugin

Sometimes it fails to open Instagram and doesn't report any error.

Not sure why, I'm still trying to figure it out...

I have the following code:

Instagram.share(square.toDataURL(), Settings.getDescription(), function (err) {
    if(err){
        alert("An error has occurred, Please go back an retry.");
        console.log(err);
    }
});

Sometimes Instagram doesn't open to share the image and there is no error...

Instagram Login

Hello Vlad, I am wondering if it is possible to extend your excellent plugin (congratulations BTW) to do 2 things:

1: Send a text message to Instagram so that the user already has some default text to publish and
2: Login to Instagram via the active session on the mobile device (like all applications do with facebook)

I hope you can help me with this, best regards!

Error: undefined is not an object (evaluating 'data.slice')

I want to share one image in my file system (file:///var/mobile/Containers/Data/Application/88F85219-C19E-452D-B5F0-11D9438DF5E5/Library/NoCloud/1453894916583.jpg)
then I call:
$cordovaInstagram.share(getBase64Image(index), null)
the function getBase64Image:

    function getBase64Image(index) {
      var ccc = "base64" + index
      console.log('BASE64', ccc);
      var img = document.getElementById(ccc);
      console.log('IMG', img);
      var canvas = document.createElement("canvas");
      canvas.width = img.width;
      canvas.height = img.height;
      var ctx = canvas.getContext("2d");
      ctx.drawImage(img, 0, 0);

      var dataURL = canvas.toDataURL();
      console.log(dataURL);
      return dataURL;
    }

My console.log of dataURL looks like a real base64 image but I still get this error:

Error: undefined is not an object (evaluating 'data.slice')
share@file:///var/mobile/Containers/Bundle/Application/640C9E51-2DE8-4DF0-A1BF-EBC99C1E63E7/alpitour.app/www/plugins/cordova-instagram-plugin/www/CDVInstagramPlugin.js:92:18
share@file:///var/mobile/Containers/Bundle/Application/640C9E51-2DE8-4DF0-A1BF-EBC99C1E63E7/alpitour.app/www/lib/ngCordova/dist/ng-cordova.min.js:8:24663

Am I missing something ?

error in the installation manual

Hello, when installing the plugin and run the app on iOS, the following error was displayed on the console:

Aerotur 06/12/2013 22:24:05.653 [1727: c07] *** Assertion failure in - [CDVConfigParser parser: parseErrorOccurred:], / Users / mayron / Desktop / aerotur / CordovaLib / Classes / CDVConfigParser.m: 67
Aerotur 06/12/2013 22:24:05.654 [1727: c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'config.xml parse error line 62 col 21'
*** First throw call stack:
(0x21f012 0x1458665 0x287fe7e 0x21ee78 0x7ac02 0x14a0a08 0x5a702af 0x5a92857 0x5a92ba7 0x5a94b14 0x5a93f07 0x14a08fe 0x14a0890 0x14a0b46 0x14a0bfa 0x5b602 0x5a3d0 0x5a49e 0x539e1e 0x5a55e 0x38b9 0x391d 0x341b 0x458157 0x458747 0x45994b 0x46acb5 0x46bbeb 0x45d698 0x36b1df9 0x36b1ad0 0x194bf5 0x194962 0x1c5bb6 0x1c4f44 0x1c4e1b 0x45917a 0x45affc 0x30fc 0x3055)
libc + + abi.dylib: terminate called throwing an exception

added to the config.xml, but you talk to put in Cordova.plist ...
I use the 2.7 version of phonegap, in my view the problem is this or am I mistaken?
The speech plugin: The plugin works with Cordova> = 1.8.1.

No know class method for selector error

i am running cordova-ios 4.0.1 and when this plugin is added it throws following error:

platforms/ios/Frockhub/Plugins/cordova-instagram-plugin/CDVInstagramPlugin/CDVInstagramPlugin.m:63:36: error: no known class method for selector 'dataFromBase64String:'
        NSData *imageObj = [NSData dataFromBase64String:objectAtIndex0];
                                   ^~~~~~~~~~~~~~~~~~~~
1 error generated.

here is my info:

Cordova CLI: 6.0.0
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic Version: 1.2.4
Ionic CLI Version: 2.0.0-beta.12
Ionic App Lib Version: 2.0.0-beta.6
ios-deploy version: 1.8.4 
ios-sim version: 4.1.1 
OS: Mac OS X El Capitan
Node Version: v4.2.3
Xcode version: Xcode 7.2 Build version 7C68 

No Pan-around option in Instagram App

When I send an image to Instagram via a cordova app, I don't get the pan-around option (in Instagram) that will allow me to select part of the image. Instead, it just crops part of the image and displays it (not sure how that is happening either).

Sharing screenshot image to Instagram

Our functionality is take the screenshot of current screen and share this image to Instagram.

We are using this https://github.com/gitawego/cordova-screenshot for taking screenshot. It will return the screenshot image path only in android.
We want to use your plugin for android only. How can we share this taken screenshot image to Instagram in android.

What is the value we should use for canvasIdOrDataUrl and caption.

Crashing on iOS 8.3 when share option tapped

I'm seeing intermittent crashes when selecting the Instagram share option from UIDocumentInteractionController share panel. Sometimes it works fine, sometimes it crashes. I've included the relevant section of the crash report below. Anyone have any ideas as to what could be causing this?

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000110
Triggered by Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001975cbbdc 0x1975b0000 + 113628
1 UIKit 0x000000018ad79d4c 0x18a81c000 + 5627212
2 UIKit 0x000000018af12ac0 0x18a81c000 + 7301824
3 UIKit 0x000000018ab32cac 0x18a81c000 + 3239084
4 UIKit 0x000000018ab35128 0x18a81c000 + 3248424
5 UIKit 0x000000018a94efcc 0x18a81c000 + 1257420
6 UIKit 0x000000018a864770 0x18a81c000 + 296816
7 UIKit 0x000000018a8642d8 0x18a81c000 + 295640
8 UIKit 0x000000018a8641e0 0x18a81c000 + 295392
9 QuartzCore 0x000000018a17968c 0x18a164000 + 87692
10 libdispatch.dylib 0x0000000197c09950 0x197c08000 + 6480
11 libdispatch.dylib 0x0000000197c0e208 0x197c08000 + 25096
12 CoreFoundation 0x0000000185da37f4 0x185cc4000 + 915444
13 CoreFoundation 0x0000000185da189c 0x185cc4000 + 907420
14 CoreFoundation 0x0000000185ccd2d0 0x185cc4000 + 37584
15 GraphicsServices 0x000000018f4eb6f8 0x18f4e0000 + 46840
16 UIKit 0x000000018a892fa8 0x18a81c000 + 487336
17 Cordova370 0x0000000100004e98 0x100000000 + 20120
18 libdyld.dylib 0x0000000197c36a04 0x197c34000 + 10756

Not working on android 6

Hi, I have succedfully integrated the plugin on android, and tested on android 5 where it's working ok, bit not on a nexus5 running android 6, is there any known workaround ?
Thanks in advance

Handle cancel event

This is a great plugin!, but I need the cancel event when a user decides not to launch Instagram.

Also the error event always get invoked

Using iPad IOS 5.1.1

cordovaRef undefined

After the last code commit, i'm getting an exception for undefined cordovaRef in www/CDVInstagramPlugin.js:45

In the last commit, this line was removed:

var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks

I'm not sure if it's a bug or if I'm doing anything wrong.

Crashes on iOS6

Plugin seems to crash when running on an iPad 2 with iOS6. Will try to get more info.

Instagram sharing sometimes crashes

I'm using the cordova Instagram plugin .. sometimes it works .. but sometimes it quits and I get the following error:

2016-01-26 12:44:27.150 myapp[13566:5763386] *** Assertion failure in -[_UIOpenWithAppActivity performActivity], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.30.14/UIDocumentInteractionController.m:408
2016-01-26 12:44:27.156 myapp 0x1821f899c 0x186bfefb0 0x186e29970 0x1868cfc90 0x1868d2e88 0x1866a7284 0x1865b3394 0x1865b2e90 0x1865b2d18 0x183f89c00 0x1002d5bb0 0x1002db658 0x18183cbb0 0x18183aa18 0x181769680 0x182c78088 0x1865e0d90 0x10007d2d0 0x18130a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

also this error, I think it's similar

2016-01-27 00:13:48.079 myapp[14240:5915310] *** Assertion failure in -[_UIOpenWithAppActivity performActivity], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.30.14/UIDocumentInteractionController.m:408
2016-01-27 00:13:48.086 myapp[14240:5915310] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController has gone away prematurely!'
*** First throw call stack:
(0x181885900 0x180ef3f80 0x1818857d0 0x1821f899c 0x186bfefb0 0x186e29970 0x1868cfc90 0x1868d2e88 0x1866a7284 0x1865b3394 0x1865b2e90 0x1865b2d18 0x183f89c00 0x1002a1bb0 0x1002a7658 0x18183cbb0 0x18183aa18 0x181769680 0x182c78088 0x1865e0d90 0x1000452d0 0x18130a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

I'm using the plugin with Ionic

Some 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.13
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.8.3
ios-sim version: 5.0.4
OS: Mac OS X El Capitan
Node Version: v4.2.2
Xcode version: Xcode 7.2 Build version 7C68

see forum post : https://forum.ionicframework.com/t/instagram-sharing-fails/42089

I sometimes have the same with Whatsapp

Caption does not enter clipboard android 4.4.2

So I am using Android 4.4.2 with the latest cordova and the latest instragram app.
In my app I take a picture and then add this to instagram using Instagram.share();

Of course I also would like to set a capture and looking into the readme file I would expext that I can paste the caption from the clipboard. However the data does not seem to enter the clipboard.
Might just be that I am doing something wrong. So just to be sure here is my code:

    cameraSuccess: function (attr) {

        window.resolveLocalFileSystemURL(attr, function (fileEntry) {

            fileEntry.file(function(file) {

                var reader = new FileReader();
                var caption = "TEST CAPTION!";

                reader.onloadend = function(e) {

                    Instagram.share(this.result, caption, function (err) {

                        /*
                        if (err) {
                            alert('Not shared on instagram');
                        } else {
                            alert("shared!");
                        }
                        */
                    });

                };
                reader.readAsDataURL(file);
            });

        }, function(err) {
            //alert(err);
        });

    },

So is this the way it supposed to work or am I just mis using the script here?

Phonegap Build

Awesome Plugin.Please submit to phonegap Build.
Thanks :-)

Ampersand

When sharing it changes & to & amp ; Anyone know a way around this?

Share Cancelled?

I'm getting "Share Cancelled" on what seems like a valid share in Android. This even happens from the demo app if I add a check on err. The share seems to go through OK and I'm left on the home screen of Instagram showing the new photo in the feed. I then hit the back arrow to get back to the calling app, and I think this is being interpreted as a cancel. Is there another way I should be leaving instagram to get back to my app after a share? This is on a Nexus 5.

More detail for install instructions

It would be very helpful to include the plugman install command for copy/paste ease as well as newbies to plugman. Showing a config code block for manual install would be helpful as well. Are there plans to fill out the help/install section a little more? Thanks!

Facebook app appears in list

Hi there,

iPhone 6, iOS 8.3

We've found that when the Facebook app is installed, the app appears in the share list. This is problematic since there is much overlap in our users who have both Instagram and Facebook installed on their phones.

image

Add option of sharing a photo from iPhone photo gallery

The plugin works great for images drawn directly within a canvas element, but not for images/photos that are located in the user's photo gallery.

(Aside 1: this is for iPhone, not sure what the behavior is for Android.
Aside 2: I'm using Cordova 2.3.0. I don't know if the behavior is different for other CDV versions.)

Per the Cordova camera API docs at http://docs.phonegap.com/en/2.3.0/cordova_camera_camera.md.html#camera.getPicture, I save the photo from "sourceType" CAMERA to "destinationType" FILE_URI. Here's my Javascript call:

navigator.camera.getPicture(onPhotoSuccess, onPhotoFail, {quality: 50, sourceType: 1, saveToPhotoAlbum: true, destinationType: 1 });

Once the photo is in the gallery I know its file:// URL. Or I can use the Cordova File API to get the location. From there, I'd like to use the Instagram plugin to share that file via Instagram.

Thanks!

The caption is not working with the latest Instagram version....

Maybe something change... and I noticed that the caption was not working...

Steps:

ionic start myApp222 blank
cd myApp222/
ionic platforms add android
cordova plugin add cordova-instagram-plugin

Add the following code inside $ionicPlatform.ready(function() {

Instagram.share("canvas", "hey!", function (err) {
    if (err) {
        console.log("not shared");
    } else {
        console.log("shared");
    }

and

<canvas id="canvas" width="5" height="5"></canvas>

inside <ion-content></ion-content>

Then do: ionic run

Share it on Instagram and notice that the "hey!" string is not there....

Thanks for the plugin/help!

Copy caption to clipboard

as outlined in this blog post Instagram no longer excepts pre-filled captions. While the plug in is still working as is, it could be improved with a copy/paste function. I have forked this repository and edited it so now the caption is copied to the clip board. However I am not familiar enough with objective-c to say that I have done this the best way, I am not even sure if this is the best way to handle this.

include caption

It has possibility to include caption?

My code, i use var caption and it was not possible

function shareOnInstagram(){
var caption = "RioMar Natal"
Instagram.share('canvasDrawImage', caption, function (err) {
if (err) {
//alert(err);
} else {
//alert('imagem compartilhada com sucesso');
}
});
}

CordovaPlugin: Attempted to send a second callback for ID: Instagram612896362

if i run the plugin in a demo app(the share function) it works , but when i integrate to the original its not showing any action ,neither error nor success(in share function) but t he isInstalled function is getting called and working correct, and in debug log i am getting this error

08-07 11:51:09.210 25214 25316 W CordovaPlugin: Attempted to send a second callback for ID: Instagram612896362
08-07 11:51:09.210 25214 25316 W CordovaPlugin: Result was: "Invalid action"

please help me with this one

Doesn't work

Here are what I did:

  1. Install ngCordova
  2. Install this plugin (My cordova is 6.1.1)

cordova plugin add cordova-instagram-plugin

Source code:

$cordovaInstagram.share(imgData, "Test").then(function() {
  alert('worked')
}, function(err) {
  alert(err)
});

The instagram app is installed at my iPhone. When I rung this app in my device and call this function, nothing happened. I checked the log in Xcode console:

2016-05-31 16:54:27.989 instagram[2194:852987] Apache Cordova native platform version 4.1.1 is starting.
2016-05-31 16:54:27.991 instagram[2194:852987] Multi-tasking -> Device: YES, App: YES
2016-05-31 16:54:28.047 instagram[2194:852987] Using UIWebView
2016-05-31 16:54:28.049 instagram[2194:852987] [CDVTimer][handleopenurl] 0.120044ms
2016-05-31 16:54:28.051 instagram[2194:852987] [CDVTimer][intentandnavigationfilter] 2.169013ms
2016-05-31 16:54:28.051 instagram[2194:852987] [CDVTimer][gesturehandler] 0.100970ms
2016-05-31 16:54:28.070 instagram[2194:852987] [CDVTimer][splashscreen] 18.012047ms
2016-05-31 16:54:28.084 instagram[2194:852987] [CDVTimer][statusbar] 13.673007ms
2016-05-31 16:54:28.085 instagram[2194:852987] [CDVTimer][keyboard] 1.298010ms
2016-05-31 16:54:28.085 instagram[2194:852987] [CDVTimer][TotalPluginStartup] 36.603987ms
2016-05-31 16:54:28.473 instagram[2194:852987] Resetting plugins due to page load.

It seems that the Instagram plugin has not installed at all (or at least not loaded). I check my plugin folder, the plugin has been installed already. What could be the reason? Thanks.

Crops when installed from Google Play

The plugin works great when testing my app. Now I have the app live on the Google play store and when it is installed from there, it crops the images in half. Only showing the top half of the image. Any thoughts on why this would be happening?

iOS 9

Looks to not be available in iOS9 - any ideas? Thanks.

Problems using the InstagramPlugin with Phonegap 3.0 and Android

Hello, I am a novice programmer so I am sorry if the question is very basic :)

I am trying to create a simple android project for sharing a photo to instagram using the plugin, similarly to the one I have seen here (for the iphone).

I created a new project and I have tried to install the plugin with plug man (I had some errors related to the config.xml file, I am using Phonegap 3.0).

To make the project run I :

  • I changed two imports in the java file as to the following (removing 'api'):
    import org.apache.cordova.CallbackContext;
    import org.apache.cordova.CordovaPlugin;
  • i set the plugin reference in the config.xml as following:
<feature name="Instagram" value="com.vladstirbu.cordova.CDVInstagramPlugin"/>

When I run the project I just get a "not shared" message. I used the function I have found the example for the iPhone:

```javascript
// Called when a photo is successfully retrieved
        //
        function onPhotoDataSuccess(imageData) {
            var smallImage = document.getElementById('smallImage');

            smallImage.style.display = 'block';

            smallImage.src = "data:image/jpeg;base64," + imageData;
            setTimeout(function () {
                Instagram.share("data:image/jpeg;base64," + imageData, function (err) {
                    if (err) {
                        console.log("not shared");
                    } else {
                        console.log("shared");
                    }
                });
            }, 500);
        }


Could you please help me in making the example working for the Android platform?

I upload the example I am working on here:

https://github.com/fabioi/instagramPluginAndroidTest.git

thank you very much in advance for your time,

Fabio  

iOS9 support

Hi,
The plugin is working smooth on previous version of iOS, but once upgrade to iOS9 it keeps returning installed false even the Instagram app is already installed.
Any idea about that?

After hitting the back button

Hi,

I have a problem using the plugin. If I call the share method but then I hit BACK (without completing the photo sharing process to Instagram) the photo taken continues to be the one in memory in the Instagram 'crop' screen (the first Instagram screen), whether or not a new photo has been taken.

I tried to kill the activity and remove the extra from the intent

this.shareIntent.removeExtra("EXTRA_STREAM");
this.cordova.getActivity().finishActivity(12345);

but I keep having the same problem.

thanks for your help,
Fabio

Cordova/PhoneGap 3.0 support

Cordova/PhoneGap APIs have changed for both iOS and Android. Upgrade plugin to support 3.0.

  • iOS version
  • Android version
  • Improved install documentation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.