Skip to content

Instantly share code, notes, and snippets.

@luispedrofonseca
Created June 18, 2014 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luispedrofonseca/8e603d3bf0b9e1704280 to your computer and use it in GitHub Desktop.
Save luispedrofonseca/8e603d3bf0b9e1704280 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Runtime.InteropServices;
public class InstagramShare
{
static string imagePath = Application.temporaryCachePath + "/temp.png";
static bool HasHandshook = false;
[DllImport("__Internal")]
static extern void _handshake();
public static void HandShake()
{
_handshake();
HasHandshook = true;
}
[DllImport ("__Internal")]
static extern void _postToInstagram (string message, string imagePath);
public static void PostToInstagram(string message, byte[] imageByteArr)
{
if(!HasHandshook)
HandShake();
System.IO.File.WriteAllBytes(imagePath, imageByteArr);
_postToInstagram(message, imagePath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment