Skip to content

An Android photo picker that allows users to log in a select photos from Instagram.

License

Notifications You must be signed in to change notification settings

OceanLabs/InstagramPhotoPicker-Android

Repository files navigation

Android Instagram Photo Picker

A Instagram image picker providing a simple UI for a user to pick photos from their Instagram account.

It takes care of all authentication with Instagram as and when necessary. It will automatically renew auth tokens or prompt the user to re-authorize the app if needed.

Video Preview

Preview

Requirements

  • Android API Level 14 - Android 4.0 (ICE_CREAM_SANDWICH)

Installation

Android Studio / Gradle

We publish builds of our library to the Maven central repository as an .aar file. This file contains all of the classes, resources, and configurations that you'll need to use the library. To install the library inside Android Studio, you can simply declare it as dependecy in your build.gradle file.

dependencies {
    compile 'ly.kite:instagram-photo-picker:1.+'
}

Once you've updated your build.gradle file, you can force Android Studio to sync with your new configuration by selecting Tools -> Android -> Sync Project with Gradle Files

This should download the aar dependency at which point you'll have access to the API calls. If it cannot find the dependency, you should make sure you've specified mavenCentral() as a repository in your build.gradle

Usage

You need to have set up your application correctly to work with Instagram by registering a new Instagram application here: https://instagram.com/developer/ . For the redirect uri use something link your-app-scheme://instagram-callback.

To launch the Instagram Photo Picker:

// Somewhere in an Activity:

import ly.kite.instagramphotopicker.InstagramPhoto;
import ly.kite.instagramphotopicker.InstagramPhotoPicker;

static final String CLIENT_ID = "YOUR_CLIENT_ID";
static final String REDIRECT_URI = "YOUR-APP-SCHEME://instagram-callback";
static final int REQUEST_CODE_INSTAGRAM_PICKER = 1;

InstagramPhotoPicker.startPhotoPickerForResult(this, CLIENT_ID, REDIRECT_URI, REQUEST_CODE_INSTAGRAM_PICKER);

Implement onActivityResult:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE_INSTAGRAM_PICKER) {
        if (resultCode == Activity.RESULT_OK) {
            InstagramPhoto[] instagramPhotos = InstagramPhotoPicker.getResultPhotos(data);
            Log.i("dbotha", "User selected " + instagramPhotos.length + " Instagram photos");
            for (int i = 0; i < instagramPhotos.length; ++i) {
                Log.i("dbotha", "Photo: " + instagramPhotos[i].getFullURL());
            }

         }
    }
}
    

Sample Apps

The project is bundled with a Sample App to highlight the libraries usage.

License

This project is available under the MIT license. See the LICENSE file for more info.

About

An Android photo picker that allows users to log in a select photos from Instagram.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages