Taylor Hill
Taylor Hill

Reputation: 1124

Android: Downloading flickr images

I have a project that I'm having trouble with (for an internship). My assignment is to create an Android app that downloads a random image from Flickr after running a search for a specified tag.

I know Flickr has an API, and I have an api key, but I'm struggling with understanding how to integrate this into an app, as it seems examples in Java are a bit sparse. Does anyone know the process of using the API to download an image after running a search? (Or if there's an easier way to do it without the API/being authenticated, that works too).

I should also mention that I can't use any external libraries.

Upvotes: 0

Views: 4228

Answers (1)

Itai Hay
Itai Hay

Reputation: 355

Well I can feel the difficulty of doing this w/o the so sweet and easy Flickrj-Android or Flickr4Java :)

The method you need is flickr.photos.getSizes.

Returns the available sizes for a photo. The calling user must have permission to view the photo.

You do not need to authenticate your API key if you do not want to download non-public photos. Just get the wanted photo-id with a simple search (flickr.photos.search) and download the wanted photo with a simple URL file stream.

The returned data has the wanted download URL. So just run a parser and download away.

Upvotes: 1

Related Questions