开发者

Writing a Mobile Application that connects to multiple Social Networking sites

I need to write an Android application that allows a user to connect to multiple social networking sites like MySpace, LinkedIn, FaceBook etc. and fetch friends list.

I know that most of these applications have Java libraries or functionalities exposed as REST based WebServices. But since there is a lot of variety and disparity in the ways that these libaries are written or service that can be consumed, is there any single, integrated service or middleware component that I can use to provide a unified interface in my mobile application?

开发者_运维问答What would be the best way to go about writing such an application? Any links or pointers to tutorials and documents would be helpful.

Thanks.


Well, that pretty much depends on the service APIs exposed by these sites. If they're RESTful, it would be easy and straight forward to write the API accessors yourself using the Apache HttpClient implementation shipped with Android.

If you want to make your life easier you may want to look at Droid-Fu's HTTP abstractions, and maybe Signpost, if you require OAuth message signing (which you need for many popular sites like Netflix, LinkedIn, Twitter, ...).

Here is some code that fetches mentions from Twitter using these two libraries:

// configure an OAuthConsumer with Twitter credentials
oauthConsumer.setTokenWithSecret(accessToken, tokenSecret);

// get Twitter mentions for the user identified by accessToken
String endpointUrl = "http://twitter.com/statuses/mentions.xml?since_id=12345";
BetterHttpResponse response = BetterHttp.get(endpointUrl).expecting(200, 404).signed(oauthConsumer).send();

if (response.getStatusCode() == 200) {
   ... // consume response
}

That stuff worked pretty well for me with the Qype API.


I'm also working on similar project. I'm planning to use some of the excellent framework an open source api for all social networking site except Facebook - http://wiki.opensocial.org/index.php?title=Main_Page opensocial for Java Client - http://code.google.com/p/opensocial-java-client/ [Android] [This is the Open Source FaceBook API for Android]3 - https://github.com/facebook/facebook-android-sdk the most useful Twitter API - http://twitter4j.org/en/index.html one of the most popular Twitter API - http://www.winterwell.com/software/jtwitter.php

And this link contains some of the excellent project for social network based android app - http://code.google.com/android/adc/gallery_social_networking.html

Cheers -Neo

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜