Skip to content

sodacan/InstagramPlugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stories in Ready

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.

Installing the plugin to your project

In your project directory:

cordova plugins 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");
    } else {
        console.log("Instagram is not installed");
    }
});

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

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

Android Quirks:

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.

License

The plugin is available under MIT license.

Bitdeli Badge

About

Instagram plugin for PhoneGap/Cordova

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 44.2%
  • Java 36.4%
  • JavaScript 19.4%