/EYeEm-Java-SDK

Android SDK wrapping the EyeEm API

Primary LanguageJava

EyeEm Android SDK


This is the first interation of our Android wrapper. The minimum SDK level is 7. Please read first our main API documentation.

Getting Started


  1. Register your app at EyeEm
  2. open the properties of your project, go on Android, add the library EyeEm Android SDK.
  3. To initialize the API use new EyeEmAPI(String clientId);
  4. Add <uses-permission android:name="android.permission.INTERNET" /> to your AndroidMainfest.xml file.

###with OAuth

If you want to use OAuth authentication you have to set the redirect_uri of your EyeEmAPI object. Also you need to do the following steps:

  1. You need to add this to your AndroidMainfest.xml file.
<intent-filter>    
    <action android:name="android.intent.action.VIEW"></action>
	<category android:name="android.intent.category.DEFAULT"></category>
	<category android:name="android.intent.category.BROWSABLE"></category>
	<data android:host="---your redirect host---" android:scheme="---your redirect scheme"></data>
</intent-filter>
  1. Extend the activity, where you want to authorize the user with EyeemConnect.

Now you are ready to go.

##How to use it


###Queries

You create a Eyeem…Query object and then set the properties the way you want to have a query. If you have an access token, it will be automatically used, otherwise your client id will be used.

https://www.eyeem.com/api/v2/users/me/friends/1013

EyeemUsersQuery query = new EyeemUsersQuery();
query.firstIdString = "me";
query.specificEndpoint = EESpecificUsersEndpoint.EEspecificUsersEndpointFriends;
query.secondId = 1013;

https://www.eyeem.com/api/v2/albums/17?detailed=1&includePhotos=1&numPhotos=2&photoDetails=1&includeContributors=1&includeLikers=1

EyeemAlbumsQuery query = new EyeemAlbumsQuery();
query.firstId = 17;
query.setDetailed(true);
query.setPhotos(true);
query.photoNumber = 2;
query.setPhotoDetails(true);       
query.setContributors(true);
query.setLikers(true);

###Request

GET, PUT and POST requests are supported. Ask us for write access. To get the query object into a ArrayList use transfromQuery().

public HashMap<String, Object> getRequest( ArrayList <NameValuePair> parameters)
public HashMap<String, Object> getRequest( ArrayList <NameValuePair> parameters, EyeemPagination pagination)
public HashMap<String, Object> putRequest(ArrayList <NameValuePair>  parameters)
public HashMap<String, Object> postRequest(ArrayList <NameValuePair>  parameters)	                       

If you use getRequest without pagination the standard values for limit and offest will be used, you can look them up here.

###Response

The response is basically the same as in the API documentation described, only that a photo dictionary is a EEPhoto object and an arry of photos an array of EEPhoto objects is. The same applies to albums and users. https://www.eyeem.com/api/v2/photos?type=popular&limit=5

{
	paginationPhotos = com.baseapp.eyeem.androidsdk.models.EyeemPagination@41295b80, 
	photos = 
	[
		com.baseapp.eyeem.androidsdk.models.EyeemPhoto@412aa998, 		com.baseapp.eyeem.androidsdk.models.EyeemPhoto@412ab0c8, 		com.baseapp.eyeem.androidsdk.models.EyeemPhoto@412c99d8, 		com.baseapp.eyeem.androidsdk.models.EyeemPhoto@412c9d08, 		com.baseapp.eyeem.androidsdk.models.EyeemPhoto@412ca038
	]
}
{
  "photos": {
    "offset": 0,
    "limit": 5,
    "total": 681,
    "items": [
      {
        "id": 984670,
        "thumbUrl": "http://www.eyeem.com/thumb/h/100/373da7354530c72410d2425afdc4e6c1101e82f9-1348242890",
        "photoUrl": "http://www.eyeem.com/thumb/640/480/373da7354530c72410d2425afdc4e6c1101e82f9-1348242890",
        "width": 1296,
        "height": 1296,
        "updated": "2012-09-21T17:54:52+0200"
      },
      {
        "id": 984662,
        "thumbUrl": "http://www.eyeem.com/thumb/h/100/c661451b3435be2d73daa897ee5a62a1096bab80-1348242734",
        "photoUrl": "http://www.eyeem.com/thumb/640/480/c661451b3435be2d73daa897ee5a62a1096bab80-1348242734",
        "width": 1296,
        "height": 1296,
        "updated": "2012-09-21T17:52:17+0200"
      },
      {
        "id": 984486,
        "thumbUrl": "http://www.eyeem.com/thumb/h/100/b97436b3302873952e06ee6c1c2274bec33f3c01-1348240283",
        "photoUrl": "http://www.eyeem.com/thumb/640/480/b97436b3302873952e06ee6c1c2274bec33f3c01-1348240283",
        "width": 1109,
        "height": 1296,
        "updated": "2012-09-21T17:11:40+0200"
      },
      {
        "id": 984604,
        "thumbUrl": "http://www.eyeem.com/thumb/h/100/7f8bf5ee3207ff60f6ff203fd45cad93d8acb5dd-1348241773",
        "photoUrl": "http://www.eyeem.com/thumb/640/480/7f8bf5ee3207ff60f6ff203fd45cad93d8acb5dd-1348241773",
        "width": 1296,
        "height": 1296,
        "updated": "2012-09-21T17:36:29+0200"
      },
      {
        "id": 984625,
        "thumbUrl": "http://www.eyeem.com/thumb/h/100/5e9173b4827bb4dfc139cb7f2b91ed722cb473c7-1348242086",
        "photoUrl": "http://www.eyeem.com/thumb/640/480/5e9173b4827bb4dfc139cb7f2b91ed722cb473c7-1348242086",
        "width": 909,
        "height": 866,
        "updated": "2012-09-21T17:41:43+0200"
      }
    ]
  }
}

###Authorize

To authorize a user call loginToEyeEm(). You can figure out whether the app opened from the autorization, you can call getIntent().getDataString().startsWith(---your redirect uri---)) in your main activity.

Image Resolution


If you want get an other photosize than the standard 640*480 pixel from the photoUrl, you can use these methods:

public String urlFromPathForPhotoWithWidthAndHeight(String urlPath,  int width, int height)
public String urlFromPathForPhotoWithWidth(String urlPath,  int width)
public String urlFromPathForPhotoWithHeight(String urlPath, int height)
public String urlFromPathForPhotoWithSquareSize(String urlPath, int imageSize)

##Contact


For feedback, questions, complaints and props, you can get in touch with us at api@eyeem.com or @eyeemapi on Twitter.

##License


EyeEm Android SDK is licensed under the Apache License, Version 2.0.