post image in Instagram

Akhilesh Mani picture Akhilesh Mani · Apr 30, 2013 · Viewed 30.1k times · Source

Question : In my app I need to post image in Instagram just like FB or Twitter.

What I have already done : Login and fetched photographs from the Instagram to my own app. But not getting any way for image posting in Instagram.

Answer

Akhilesh Mani picture Akhilesh Mani · Apr 30, 2013

Yet it is not possible to post image in Instagram like FB or twitter.

But this is another way to achieve this using already installed Instagram and if not this will notify user to download app .

 public void onClick(View v) {

        Intent intent = getPackageManager().getLaunchIntentForPackage("com.instagram.android");
        if (intent != null)
        {
            Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.setPackage("com.instagram.android");
            try {
                shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getContentResolver(), imagePath, "I am Happy", "Share happy !")));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            shareIntent.setType("image/jpeg");

            startActivity(shareIntent);
        }
        else
        {
            // bring user to the market to download the app.
            // or let them choose an app?
            intent = new Intent(Intent.ACTION_VIEW);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.setData(Uri.parse("market://details?id="+"com.instagram.android"));
            startActivity(intent);
        }

    }