Friday, October 22, 2010

Using Facebook SDK in Android Applications

Howto publish images and links with Android in your Facebook Wall using stream.publish method from Facebook SDK:

1st: Download Facebook SDK using git. http://github.com/facebook/facebook-android-sdk
(highly recommended to play a little with Example.java and other methods)

2nd: create a new project from Example.java

3rd: create a Bundle with all the parameters to post and publish it using SampleDialogListener
             Bundle parameters = new Bundle();

               parameters.putString("method","stream.publish");
               String mylink="http://kinesina.blogspot.com";
                String myimagelink="http://kinesina.blogspot.com";
               String attachments = "{
                                   \"name\":\"Location Here\",
                                   \"href\":\""+mylink + "\",
                                   \"caption\":\"Click to view in Google Maps\",
                                   \"media\":[{
                                           \"type\":\"image\",
                                           \"src\": \"http://myimgurl\",
                                           \"href\": \""+myimagelink+"\"}]}";

                parameters.putString("attachment", attachments);
                mFacebook.dialog(Example.this, "stream.publish", parameters, new SampleDialogListener()) ;

4th: Using LocationManager and Google Maps API (which I will explain soon), you can post your location and a link to google maps in your facebook wall! 


If you liked this app (WhereAmI) you can download it from Android Market for free, or mark/like it on facebook (available soon).

Hope you like it, 'cause it is gonna be my first app published in Android Market!

Tuesday, October 19, 2010

Android SDK for Eclipse running in Ubuntu 10.10

After upgrading my Ubuntu to 10.10, I got the same error as explained in http://sonalsantan.blogspot.com/2010/10/eclipse-adt-plugin-on-ubuntu-1010-after.html


"I found that my Eclipse Android Development Toolkit plugin stopped working. The Eclipse Help>Installation Details Menu would list ADT under Installed Software Tab. However, neither the Features Tab nor the Plug-ins Tab would list ADT."


Also, the installation of  gef would fail due to the lack of some packages, solution found here http://ubuntuforums.org/showthread.php?t=1305691


Finally, in order to get Eclipse working with ADT plugin in Ubuntu 10.10, I did the following steps:


1. Exit eclipse if running
2. Delete ~/.eclipse/org.eclipse.platform_(your platform)
3. Start eclipse
4. Open Help > Install New Software
5. Add this sites:
      5.1 http://download.eclipse.org/datatools/updates
      5.2 http://download.eclipse.org/webtools/updates
      5.3 http://download.eclipse.org/modeling/emf/updates
6. Install GEF Plugin (previously add the site http://download.eclipse.org/tools/gef/updates/releases)
7. Install ADT Plugin (previously add the site https://dl-ssl.google.com/android.eclipse