Friday 25 October 2013

Facebook App Development on Android

On Facebook
Firstly, we talk about the tasks and tools available on Facebook developers.

Now, login to your FB account, go to "Manage Apps"

Choose "Edit App" or "Create New App".

Here are the basic settings of the App:

Then, choose "Use Graph API Explorer".
Enter the POST action path: "me/victory-test-now:gin"

victory-test-now is the namespace, gin is the Action. You may have to add the Action in the "Open Graph" section beforehand.


The food url is from "Open Graph->Types":

After clicking submit button in the Graph API Explorer, go to the Activity Log of the user. You can see the Action in the Activity Log.

You can add a place field to the POST Action.

The place id can be obtained using the following method.

Click on the profile picture, right click, choose "Copy link address"

For example, the link address is below.
https://www.facebook.com/photo.php?fbid=10150753663333147&set=a.438257763146.238406.145768288146&type=1&source=11

The place id is "145768288146".

The Action can be seen in the Activity Log again.

On Android
Secondly, we highlight how the Android App is able to access the data in Facebook through the Facebook App.

Preparation steps:

  • Download the Facebook SDK for Android
  • Import the SDK into Eclipse
  • Compile and build it

After that, you can start to create an Android App in Eclipse. The good tutorial from FB is listed below:
https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/

After you have created the Android App, we go back to the App Dashboard on Facebook Developers, and register the Android package and activity name in the "Native Android App" settings. As an example, the detail info is shown below.

To get the Key Hash, add the code to the OnCreate() method of the MainActivity class.
    // Add code to print out the key hash
    try {
        PackageInfo info = getPackageManager().getPackageInfo(
                "com.facebook.samples.hellofacebook", 
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }
Publish to Facebook Feed

In the Facebook tutorial below,
https://developers.facebook.com/docs/android/scrumptious/publish-open-graph-story/
it talks about publishing to Open Graph story.

You could modify the code to make it publish to Facebook Feed. Sounds interesting, isn't it? The essential changes are:

1) populate the Bundle with the description, link, name, caption
2) change the post action path to "me/feed"

The obvious changes are not difficult. However, you may have to retrieve the user info from List<GraphUser>.

                        public String announceString;
                        ...
                        private List<GraphUser> selectedUsers;
                        ...
                     for (GraphUser user : selectedUsers) {
                         announceString += user.getName();
                     }

The changes to AsyncTask:

AsyncTask<Void, Void, Response> task =
    new AsyncTask<Void, Void, Response>() {

    @Override
    protected Response doInBackground(Void... voids) {
        // Create an eat action
        EatAction eatAction =
        GraphObject.Factory.create(EatAction.class);
        // Populate the action with the POST parameters:
        // the meal, friends, and place info
        for (BaseListElement element : listElements) {
            element.populateOGAction(eatAction);
        }
        // Set up a request with the active session, set up
        // an HTTP POST to the eat action endpoint
         // Request request = new Request(Session.getActiveSession(),
         //         POST_ACTION_PATH, null, HttpMethod.POST);
        Bundle postParams = new Bundle();
        postParams.putString("name", "Gin food");
        postParams.putString("caption", "Gin food");
        postParams.putString("description", announceString);
        postParams.putString("link", announceUrl);
        Request request = new Request(Session.getActiveSession(),
        "me/feed", postParams, HttpMethod.POST);
       
        // Add the post parameter, the eat action
        request.setGraphObject(eatAction);
        // Execute the request synchronously in the background
        // and return the response.
        return request.executeAndWait();
    }

    @Override
    protected void onPostExecute(Response response) {
        // When the task completes, process
        // the response on the main thread
        onPostActionResponse(response);
     }
};

54 comments:

  1. Maybe they finally improve memory management of Facebook app? Right now 15.7MB of my Samsung Epic 4G memory is wasted by Facebook picture upload service, even though I have not used Facebook app today and never uploaded a single picture. Killing Facebook app/service doesn't help - Android immediately restores it.

    ReplyDelete
  2. I'm not certain when i comprehend you right, yet in the event that do and assuming that you are searching for a cross stage application, then you may as well attempt Phonegap. Phonegap can manage very nearly all portable stages i know. In this test, I can not help you a whole lot sadly. At the same time I composed one post here about Phonegap.
    Andriod Application Development // iPhone Application Development // Mobile Application Development

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Thats quite a good collection of android development guides....

    Facebook app developers


    ReplyDelete
  5. Appaustic- we are able to provide a full variety of fb application strategy, design, development and advertising for your business.Facebook app development company

    ReplyDelete
  6. I really enjoyed this posting in which you share a valuable post. Thanks for sharing it.
    Facebook app development company

    ReplyDelete
  7. https://triangularapps.blogspot.com/p/open-in-whatsapp.html?showComment=1587307861240

    ReplyDelete

  8. https://triangularapps.blogspot.com/p/open-in-whatsapp.html?showComment=1587307861240

    ReplyDelete
  9. Nice post. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated posts.
    Best Mobile App Development

    ReplyDelete
  10. Learn the latest digital marketing strategies, different Types of Mobile App Development, and much more to become a Digital marketing expert. Visit our portal to know more about the Best Web Design Company in Anna Nagar. We are working on Mobile app development, website development, content marketing, and SEO marketing. The different types of Mobile app development include using the cloud platforms; web-based mobile app development and lot more. These apps are coded using different languages.

    ReplyDelete
  11. Your blog is really great! Your blog is great for anyone who wants to understand this subject more. I hope your blog is written the more the better!

    Flutter app Entwickler

    ReplyDelete
  12. Nice article and it’s really helpful content for us, keep sharing like this more informational article. If you a looking Leading Mobile App Development Company in Dubai. Visit: Mobile App Developers in Dubai

    ReplyDelete
  13. love the post!!!
    Thank you for your intelligent post and for helping others become more aware. You made more sense than others who speak within this same area of expertise and I am really glad I found your blog-website. I’ve joined your social networks and will keep an eye out for future great posts as well. Additionally, I have shared your site in my social networks as well. Thank you again!
    Instagram Clone

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hello!!
    Thanks for sharing information related to facebook software development on android. You provide complete details and step by step information for facebook app development. It is very helpful for android developers. I hope you will share some more information about it. For any software development please visit Software development Company

    ReplyDelete
  16. Thanks for sharing a beautiful food related blog Thanks for sharing it.
    Food Delivery App Development Company

    ReplyDelete
  17. Awesome! Thanks for sharing this informative post and Its really worth reading.AR App

    ReplyDelete
  18. Movies, a word that fascinates everyone. As everyone likes to watch movies and all, but the reason in today's time is that where to watch movies.

    movie downloader apk
    movies time apk

    ReplyDelete
  19. Nice article, Shared useful information about mobile technology. We are an Mobile App Development Company Islamabad,
    Mobile App Development Company Islamabad

    ReplyDelete
  20. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    VR Ottawa

    ReplyDelete
  21. If you are looking to develop an Android App,you might be overwhelmed by the process. There are a lot of things to think about, such as the development time, cost, programming language, etc. However, it is possible to create a great android app without having to spend a lot of money or devote a long time. There are a few things you should know about developing an android app, such as the effort that it takes to complete one, the cost, and what the future might hold for android apps.

    ReplyDelete
  22. Thanks for sharing this informative content. Keep posting.
    Android Activity Lifecycle

    ReplyDelete
  23. Thanks for sharing such amazing content which is very helpful for us. Please keep sharing like this. Also check for Mobile Apps Development using React Native or many more.

    ReplyDelete
  24. Thank you, this article is very useful. I searched anything about app development for Android and here it is
    In the meantime please check Mobile App for location tracking in Spain

    ReplyDelete
  25. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. acmarket

    ReplyDelete
  26. Outstanding post, Keep going on and providing this kind of information.
    If any one need App Development Services then contact us

    ReplyDelete
  27. Once again you provide several doses of reality which explore the complete explanation of packing and moving companies in Bangalore. This article don't have to be that long. I simply couldn't leave your web site before suggesting that I actually loved the usual info on packing and movers services in Bangalore.

    ReplyDelete
  28. Clear cut explanation. Am pretty much impressed with your explanation. Looking for the best phone gap app development services in Hyderabad, India? Contact Cyanous software solutions now.

    Best network penetration testing services in Hyderabad
    Best software & web development company in Hyderabad

    ReplyDelete
  29. thanks for shirting this information of "Facebook App Development on Android".
    Mobile App Development Company

    ReplyDelete
  30. Very nice blog. Thanks for sharing content and such nice information for me. I hope you will share some more content about. get developing advanced Please keep sharing! Android App Development

    ReplyDelete
  31. As a leading Top Mobile App Development Company in India, Appsinvo company is well known to design and build customized web and mobile app solutions for the clients. Complete integration of the mobile app and the website gives the businesses a boost not only in their growth but also in the revenue.
    Top Mobile App Development Company in Mumbai

    ReplyDelete
  32. As a leading Top Mobile App Development Company, Appsinvo company is well known to design and build customized web and mobile app solutions for the clients.
    Complete integration of the mobile app and the website gives the businesses a boost not only in their growth but also in the revenue.
    Top Mobile App Development Company in Delhi

    ReplyDelete

  33. Native App Development
    App Design is a leader in high quality, efficient, and high-performance native application development services

    professional mobile app development
    maintenance for small site
    web design services
    tailor made mobile app development
    mobile app development website design

    ReplyDelete
  34. quite insightful blog! developing app like facebook is a tough task ! If you are unable to codify it yourself you can book a developer !

    ReplyDelete
  35. Thank you for sharing this fantastic article. If you are looking for a Top Android App Development Company or want to know how much it costs to hire top mobile app developers in India, please read our most recent blog.

    ReplyDelete
  36. Hi, I found your blog on Google when I was looking for the best mobile app development services, and I really like your blog. Thanks for sharing this wonderful blog. Please continue this.

    ReplyDelete
  37. Good post and i would like also share about mobile app development. You can check here.

    ReplyDelete
  38. Thank you for sharing such a useful Blog post. Your blog is very informative. If you need any information "fuel delivery application development". you can connect me.

    ReplyDelete
  39. Thanks for sharing Valuable information. Keep Sharing.

    Android App Development Company

    ReplyDelete
  40. The rapid application development process is different. Instead of lots of detailed planning, you break the project into five phases: business modeling, data modeling, process modeling, application generation, and testing and turnover.
    application development services

    ReplyDelete
  41. "Health and fitness apps have been a game-changer for me. They keep me motivated and accountable for my fitness goals.".
    mobile app development companies dubai

    ReplyDelete
  42. Great article thank you for sharing the interested article with us.
    Best Software testing services.

    ReplyDelete
  43. Unlock the power of innovation with CMOLDS, the premier mobile app development company in Dubai. Our expert team crafts cutting-edge mobile solutions tailored to your needs, ensuring unparalleled success in the digital realm.

    ReplyDelete
  44. Do you wish to add value to your business by building brand awareness, gaining loyal customers, and providing insightful data? App Development services are the solutions to all your needs. Build your custom mobile app with CDN at an affordable budget. We are the most trusted Custom Mobile Application Development Company providing enterprise app development services for all industries irrespective of size and location.

    ReplyDelete