Code Monkey home page Code Monkey logo

sharewithinstagram's Introduction

IOS Sharing With Instagram App ANE

===============

iOS sharing for Instagram - Adobe Air Native Extension

If your application creates photos and you'd like your users to share these photos using Instagram, you can use the Document Interaction API to open your photo in Instagram's sharing flow.

iPhone-Hooks

ENJOY! :)

Adobe Air Native Extension Help http://help.adobe.com/en_US/air/build/WS597e5dadb9cc1e0253f7d2fc1311b491071-8000.html

The easiest way to integrate iOs Library is via Xcode. And using ActionScript Mobile Library via Apache Flex SDK.

If you're still living in the Xcode (Objective-C style), add the following files to your project:

  • FlashRuntimeExtension.h
  • ShareWithInstagram.h
  • ShareWithInstagram.m
  • Instagram.h
  • Instagram.m

See ShareWithInstagram - SharedInstance in the Objective-C Library project for details of how to use this class. In short, though:

    NSData *d = toNSDataByteArray(argv[0]);
    UIImage *image=[UIImage imageWithData:d];
    NSString *caption = toFREObjectToNSString(argv[1]);
    [[ShareWithInstagram sharedInstance] shareImage:image withCaption:caption];

ActionScript Flex Mobile Library Project functions:

  • isInstagramInstalled : The installation instagram checks whether there
  • shareWithInstagram : Open your image with instagram app for share (ByteArray and String Caption)

USAGE The Ane File:

    //Image ByteArray data Share with Instagram.
             
    if(com.azer.ios.Share.getInstance().isInstagramInstalled())
    {
            var byte:ByteArray = new ByteArray();
            byte=YourBitmapData.encode(YourBitmapData.rect, new JPEGEncoderOptions(90), byte);
            com.azer.ios.Share.getInstance().addEventListener(StatusEvent.STATUS, onStatusHandler);
            com.azer.ios.Share.getInstance().postToInstagram(byte, "Your Caption Here");
    }

    function onStatusHandler(event:StatusEvent):void{
            // you call here :  com.azer.ios.Share.getInstance().dispose();
    }

These classes are ARC enabled, but you can -fobjc-arc them to use in non-ARC projects (not required if you're using Xcode).

You must first save your file in PNG or JPEG (preferred) format and use the filename extension ".ig". Using the iOS Document Interaction APIs you can trigger the photo to be opened by Instagram. The Identifier for our Document Interaction UTI is com.instagram.photo, and it conforms to the public/jpeg and public/png UTIs. See the Apple documentation articles: Previewing and Opening Files and the UIDocumentInteractionController Class Reference for more information.

Alternatively, if you want to show only Instagram in the application list (instead of Instagram plus any other public/jpeg-conforming apps) you can specify the extension class igo, which is of type com.instagram.exclusivegram.

When triggered, Instagram will immediately present the user with our filter screen. The image is preloaded and sized appropriately for Instagram. Other than using the appropriate image format, described above, our only requirement is that the image is at least 612px tall and/or wide. For best results, Instagram prefers opening a JPEG that is 612px by 612px square. If the image is larger, it will be resized dynamically.

To include a pre-filled caption with your photo, you can set the annotation property on the document interaction request to an NSDictionary containing an NSString under the key "InstagramCaption". Note: this feature will be available on Instagram 2.1 and later.

An important note: If either dimension of the image is less than 612 pixels, Instagram will present an alert to the user saying we were unable to open the file. It's our current policy not to upscale or stretch images to our minimum dimension.

sharewithinstagram's People

Contributors

sharkhack avatar

Watchers

 avatar  avatar

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.