简体   繁体   中英

Share in instagram without login into instagram app in android

I am implementing below code for sharing image and text on instagram:

public void ShareInstagram() {
        Log.e("SHARE", "IN INSTAGRAM");
        Intent intent = getActivity().getPackageManager()
                .getLaunchIntentForPackage("com.instagram.android");
        if (intent != null) {
            String type = "image/*";
            Intent share = new Intent(Intent.ACTION_SEND);
            share.setType(type);

            share.putExtra(Intent.EXTRA_STREAM, file);
            share.putExtra(Intent.EXTRA_TEXT, SHARE_NAME);
            share.setPackage("com.instagram.android");
            share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            // Broadcast the Intent.
            startActivity(share);
        } else {
            Intent inplay = new Intent(Intent.ACTION_VIEW);
            inplay.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            inplay.setData(Uri.parse("market://details?id="
                    + "com.instagram.android"));
            startActivity(inplay);
        }

    }

when i share from my app in instagram and i am not logged in instagram then it open the login or signup screen of instagram application and display toast message for must login for sharing. and after that when i press back button, i am moving to my app with resume activity of sharing. but i couldnt access any control of screen. if i press back again then only i can access it.

this problem is only occur when i am not login into instagram application. Help me with proper solution.

I also noticed this issue. It seems to be a problem of instagram version. I was using the old one. After updating to the latest version, this issue was resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM