Flickr API on Android?
Asked Answered
K

5

9

I want to use Flickr API for downloading the images on Android Phone, can any one give or tell, me about the working sample of Flickr API on Andorid.

I have add the flickr.jar as the external library, and i have the "Key"and "Secret" but i do not know how to download the images.

Kinsfolk answered 20/1, 2011 at 14:27 Comment(0)
E
9

All it takes is just 3 steps and you will have it implemented.

Step 1: Find your user id.

The easiest way is to use this service http://idgettr.com/

Step 2: Acquire you flickr api key

Just log-in to you account and click this link http://www.flickr.com/services/api/misc.api_keys.html

Step 3: Get the code from the example project from our blog

http://www.quintostdio.com/blog/archives/1117

Add you user id and api key on the FlickrActivity class (in the package com.quintostdio.test.flickr.ui) and run the example. You can copy paste the classes and add it to your project, with no more changes and it will work.

Epiphysis answered 26/6, 2012 at 10:57 Comment(4)
always returning empty json only @Thanos KarpouzisBlastocyst
yes @Thanos Karpozis, I am also getting Photoset jsonArray always empty. Is there any mistake in code or there is something which i am not doing correctlyHysteresis
not working.getting blank screen .plz update code if posssibleSwordtail
Link at the step 3 not working anymore, so this has become an invalid answer.Harappa
C
5

Hi I have built a Flickr Java library for Android: http://code.google.com/p/flickrj-android/

Complainant answered 12/10, 2011 at 13:9 Comment(1)
This project is outdated, 2012 being the last time it was updated.Harappa
N
4

You'll need to look in their documentation on the Flickr site. Most likely will use the Java library and import it into your Android project.

Probably have to instantiate an object, using the Key and Secret. Once you have a valid authentication object, you'll use a provided method (from the docs) to get a picture.

Have a look here: http://www.flickr.com/services/api/

Nutriment answered 20/1, 2011 at 14:53 Comment(0)
H
0

@Todd DeLand answer is pretty accurate even nowadays.

However, I'll speed you up the search and tell you that the flickrj-android is not anymore up to date, as you can check in the Downloads page https://code.google.com/archive/p/flickrj-android/downloads

The other project that is listed in the Flickr API page ( http://www.flickr.com/services/api/ ), Flickr4Java, it's definitely working nowadays since I just tested it today and so far is doing it's job pretty nicely.

Github repo: https://github.com/boncey/Flickr4Java

Gradle config to add in your project (be careful, since in the README it appears another Gradle configuration, which is for the project that Flickr4Java is based on, and is NOT working):

implementation "com.flickr4java:flickr4java:2.17"

As of today, Flickr4Java was last updated on Nov 11, 2017, which is not bad.

This is an example of how I sent a query to get the pictures around a certain location (latitude,longitude):

    Thread thread = new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                String apiKey = "MY_API_KEY";
                String sharedSecret = "MI_API_SECRET";
                REST rest = new REST();
                Flickr flickrClient = new Flickr(apiKey, sharedSecret, rest);

                SearchParameters searchParameters = new SearchParameters();
                searchParameters.setLatitude(exampleLatitude);
                searchParameters.setLongitude(exampleLongitude);
                searchParameters.setRadius(3); // Km around the given location where to search pictures

                PhotoList photos = flickrClient.getPhotosInterface().search(searchParameters,5,1);
            } catch (Exception ex) {
                Log.d(MapApplication.LOG_TAG, ex.getLocalizedMessage());
            }
        }
    });

    thread.start();
Harappa answered 6/6, 2018 at 13:31 Comment(0)
P
0

I would avoid flickr4java. I assumed it worked at first but after incorporating it in to my project I have found that it crashes the app intermittently. very annoying and has been a big waste of time :(. probably works fine under other java apps but does not seem to play well with android :(

Pyrex answered 17/3, 2019 at 5:42 Comment(1)
hello from 2022! i am using flickr4java and it’s glorious…never caused any crashing for me.Undine

© 2022 - 2024 — McMap. All rights reserved.