Flickr API for Windows Phone 7 – Part 1 - An Introduction

DZone 's Guide to

Flickr API for Windows Phone 7 – Part 1 - An Introduction

· Mobile Zone ·
Free Resource

Flickr is an exceptional service that allows people from all over the world to share their photo/graphic creations. It also offers a great API that allows developers to create applications that will eventually use this service outside the web browser. I decided to start a series of articles that will show how to create a Flickr application from the ground up for Windows Phone 7. Along the way, I will try to highlight some interesting aspects as well as warn about potential problems. I would really appreciate any feedback on about my code and general coding approaches, as it’s never too late to improve existing knowledge and methodologies.

What’s the Flickr API?

Flickr has a public API (free for non-commercial use) that can be used by developers. Via a couple of web interfaces it is possible to manage your Flickr account as well as view existing content. Before going any further, I must say that it is a good idea to register a sample application since I will also be talking about the Flickr Authentication API, and that will require that you have an active API key, that can be obtained here.
You will be prompted to enter some details about your application, so fill that form out with details about your project:

Once you complete the form, you will obtain an API key and a secret hash. Make sure you keep them safe, as those will be your unique application identifiers.

Now you need to edit the flow for this registered application, as this will define its future behavior. Click on the Edit auth flow for this app link below the secret hash. A new form will be loaded asking you to provide some more details about your application. This is necessary for further authentication and identification, so make sure you set it up correctly.

You can see that I’ve entered a sample description and set the app type to Mobile (since it will be indeed launched on a mobile platform). The permissions define what the user will be able to do. According to this page, the Delete option will let the user read and write private information as well as delete pictures (this is the maximum permission set), so I picked it. It really depends on the purpose of your applications, so if you intend to develop an application that will only be used as a viewer, then obviously you won’t need write or delete permissions. The application logo is optional, so if you don’t have one at the moment or don’t have time to design one - don’t worry about it. Once you filled this form, make sure you save your authentication URL – you will need it later on.

Before I go any further with this, here are some points I’d like you to consider as you follow this set of articles:

•    I am going to use JSON-formatted responses, so before going any further I would recommend you to get acquainted with what’s JSON and how it’s formatted.  
•    Skim though the Flickr API documentation to get an idea of what this project is going to be like.
•    If you don’t want to start from scratch, you can always use the Flickr.NET library that will allow you to access Flickr data directly from your .NET application. However, I am not covering the usage of this library in this article.
•    Eventually, you might want to compile a single library for the methods covered in this article set for easier reuse. It’s a good idea, however in the context of my application I will integrate the classes directly, so it will be up to you to create a separate DLL.
•    I am not really focusing on the UI here – more on the actual functionality and user interactions, so if you want to improve or customize my XAML markup, you are more than welcome to do so.
•    Windows Phone 7 is a platform with limited resources, so performance is the key. I will try to make the API calls with minimum resource footprint. This subsequently requires you to be familiar with asynchronous operations. I only need you to know the basics to follow my code.

You’re now ready to go further with development of a Flickr client for Windows Phone 7. In the next articles I will start covering direct API calls and how to handle them, so stay tuned.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}