피드에 공유하기

피드에 공유하기를 통해 앱 사용자가 콘텐츠를 Instagram 피드에 공유하도록 지원할 수 있습니다.

개요

Android 암시적 인텐트와 iOS 범용 링크 또는 문서 상호작용을 사용하면 앱에서 사진과 동영상을 Instagram 앱으로 보낼 수 있습니다. Instagram 앱이 이 콘텐츠를 받아서 피드 작성기에 읽어들이면 사용자가 콘텐츠를 Instagram 피드에 게시할 수 있습니다.

Android 개발자

Android 구현에서는 EXTRA_STREAM extra가 포함된 암시적 인텐트를 사용하여 사용자에게 Instagram 앱을 선택하라는 메시지를 표시합니다. 사용자가 앱을 선택하면 인텐트가 Instagram 앱을 실행하고 콘텐츠를 전달합니다. 그러면 Instagram 앱은 피드 작성기에 콘텐츠를 읽어들입니다.

일반적으로 공유 플로는 다음과 같습니다.

  1. Instagram 앱에 전달하고자 하는 콘텐츠로 암시적 인텐트를 인스턴스화합니다.
  2. 활동을 시작하고 암시적 인텐트를 찾을 수 있는지 확인합니다.
  3. 인텐트를 찾을 수 있다면 활동을 찾습니다.

공유 가능한 콘텐츠

Instagram 앱에 전달할 수 있는 콘텐츠는 다음과 같습니다.

콘텐츠파일 형식설명

이미지 자산

JPEG, GIF 또는 PNG

-

파일 자산

MKV, MP4

최소 재생 시간: 3초, 최대 재생 시간: 10분, 최소 크기: 640x640픽셀

이미지 자산 공유하기

String type = "image/*";
String filename = "/myPhoto.jpg";
String mediaPath = Environment.getExternalStorageDirectory() + filename;

createInstagramIntent(type, mediaPath);

private void createInstagramIntent(String type, String mediaPath){

    // Create the new Intent using the 'Send' action.
    Intent share = new Intent(Intent.ACTION_SEND);

    // Set the MIME type
    share.setType(type);

    // Create the URI from the media
    File media = new File(mediaPath);
    Uri uri = Uri.fromFile(media);

    // Add the URI to the Intent.
    share.putExtra(Intent.EXTRA_STREAM, uri);

    // Broadcast the Intent.
    startActivity(Intent.createChooser(share, "Share to"));
}

동영상 자산 공유하기

String type = "video/*";
String filename = "/myVideo.mp4";
String mediaPath = Environment.getExternalStorageDirectory() + filename;

createInstagramIntent(type, mediaPath);

private void createInstagramIntent(String type, String mediaPath){

    // Create the new Intent using the 'Send' action.
    Intent share = new Intent(Intent.ACTION_SEND);

    // Set the MIME type
    share.setType(type);

    // Create the URI from the media
    File media = new File(mediaPath);
    Uri uri = Uri.fromFile(media);

    // Add the URI to the Intent.
    share.putExtra(Intent.EXTRA_STREAM, uri);

    // Broadcast the Intent.
    startActivity(Intent.createChooser(share, "Share to"));
}

iOS 개발자

iOS 구현은 범용 링크를 사용하여 Instagram 앱을 실행하고 콘텐츠를 전달하거나 특정 작업을 수행하도록 할 수 있습니다.

범용 링크

다음 표에 나와 있는 범용 링크를 사용하여 Instagram 앱에서 작업을 수행합니다.

범용 링크작업

https://www.instagram.com

Instagram 앱을 실행합니다.

https://www.instagram.com/create/story

카메라가 아닌 기기에서 카메라 뷰 또는 사진 라이브러리를 켜고 Instagram 앱을 실행합니다.

https://www.instagram.com/p/{media_id}

Instagram 앱을 실행하고 지정된 ID 값(int)과 일치하는 게시물을 읽어들입니��.

https://www.instagram.com/{username}

Instagram 앱을 실행하고 지정된 사용자 이름 값(string)과 일치하는 Instagram 사용자를 읽어들입니다.

https://www.instagram.com/explore/locations/{location_id}

Instagram 앱을 실행하고 지정된 ID 값(int)과 일치하는 위치 피드를 읽어들입니다.

https://www.instagram.com/explore/tags/{tag_name}

Instagram 앱을 실행하고 지정된 이름 값(string)과 일치하는 해시태그에 대한 페이지를 읽어들입니다.

Objective-C 코드 샘플

Objective-C로 작성된 다음의 예시는 카메라 뷰로 Instagram 앱을 실행합니다.

NSURL *instagramURL = [NSURL URLWithString:@"https://www.instagram.com/create/story"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    [[UIApplication sharedApplication] openURL:instagramURL];
}

문서 상호작용

앱에서 사진을 만들고 사용자가 Instagram을 통해 이러한 사진을 공유하게 하려면 문서 상호작용 API를 사용하여 Instagram 공유 플로에서 사진을 열 수 있습니다.

먼저 PNG 또는 JPEG(선호) 형식으로 파일을 저장하고 파일 이름 확장자는 .ig를 사용합니다. iOS 문서 상호작용 API를 사용하면 Instagram에서 열 사진을 트리거할 수 있습니다. 문서 상호작용 UTI의 식별자는 com.instagram.photo이며 public/jpegpublic/png UTI를 준수합니다. 자세한 내용은 Apple 문서의 파일 미리 보기 및 열기UIDocumentInteractionController 클래스 참고 자료를 참조하세요.

또는 앱 리스트에서 (Instagram 및 다른 public/jpeg 준수 앱을 함께 표시하지 않고) Instagram 표시하고 싶다면 com.instagram.exclusivegram 유형의 확장자 클래스 igo를 지정할 수 있습니다.

Instagram은 트리거되는 즉시 사용자에게 Facebook 필터 화면을 보여줍니다. 이미지는 미리 읽어들여져 Instagram에 맞게 크기가 조정됩니다. 최상의 결과를 얻기 위해 Instagram에서 640x640픽셀의 정사각형 JPEG를 여는 것이 좋습니다. 이미지가 그보다 클 경우 동적으로 조정됩니다.