Android Instagram Connector: use Instagram API
Edit your build.gradle file with:
dependencies {
compile 'eu.marcocattaneo.androidinstagramconnector:android-instagram-connector:1.3.2'
}
Instagram instagram = Instagram.newInstance(this, "<CLIENT_ID>", "<CLIENT_SECRET>", "http://callback");
instagram.getSession(new InstagramListener() {
@Override
public void onConnect(InstagramSession session) {
session.execute("/users/self", new RequestCallback() {
@Override
public void onResponse(int resultCode, @Nullable String body) {
// body = json response
}
});
}
@Override
public void onError(ConnectionError error) {
}
});
To manage login permission, for more detail .
Instagram instagram = Instagram.newInstance(this, "<CLIENT_ID>", "<CLIENT_SECRET>", "http://callback");
instagram.addScopes(new HashSet<Scope>() {{
add(Scope.BASIC);
add(Scope.PUBLIC);
add(Scope.FOLLOWER);
}});
...
To logout you can invoke logout() method on the InstagramSession.
Copyright 2016 Marco Cattaneo
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.