Tuesday 10 November 2015

Facebook App Deep Linking - Andoid

One of the most interesting aspects of sharing to Facebook from your app is that when people engage with the feed stories posted from your app, those stories can send people to your app or your app's Google Play listing, driving traffic and app installs. You can implement this behavior using App Links.

   App link Flow


Facebook's Mobile Hosting API for App Links:


If your application doesn't have a website for content you want to share to Facebook, you don't have public web URLs which you can annotate to support App Links.

For these types of apps, Facebook provides an App Links Hosting API that will host App Links for you. With the Hosting API you can create and manage your App Links for all the mobile environments you support.

This is the typical flow to configure an App Link for a piece of content:
  1. Create a new App Link object. You can set up an object for one platform or several at the same time.
  2. Save the App Link object ID that's returned.
  3. Use that ID to get the URL you can use to share the content.
  4. Configure additional platforms that you support.
  5. If supporting Android, configure your app's manifest file for the configured URLs.

Please follow below steps for generate app linking.


For web service, In request Params we need to send below parameters.

iOS: url, name
Android: url, name

Step #1: Generate App Access Token (Ref. https://developers.facebook.com/docs/facebook-login/access-tokens#apptokens)

GET /oauth/access_token?     client_id={app-id}    &client_secret={app-secret}    &grant_type=client_credentials


Step #2: Generate App Link using generated App Access Token (Ref. https://developers.facebook.com/docs/applinks/hosting-api)


You create a new App Link object for a content targeted to iOS & Android  like this

curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="iOS App Link Object Example" \
-F ios=' [
    {
      "url" : "applinkFB://showApp/54eee6292658c7df25000004",
      "app_store_id" : 570281083,
      "app_name" : “appName”,
    },
  ]' \
-F android=' [
    {
      "url" : "applinkFB://showApp/54eee6292658c7df25000004",
      "package" : "com.packagename”,
      "app_name" : “appName”,
    },
  ]' \

-F web=' {
    "should_fallback" : false,
  }'


A successful call returns an ID that represents the App Link object hosted on Facebook,
for example:

Return : {"id":"643402985734254"}

Step #3: Using generated ID(YOUR_APP_LINK_HOST_ID) which represents the App Link, you need to call another API which will return "canonical_url"


You can retrieve the canonical URL that points to your new App Link object through this API call:

curl -G https://graph.facebook.com/YOUR_APP_LINK_HOST_ID \
-d access_token="APP_ACCESS_TOKEN" \
-d fields=canonical_url \
-d pretty=true

Where YOUR_APP_LINK_HOST_ID represents the id returned from creating your App Link object. Your response will look like this:

Return:
{
   "canonical_url": "https://fb.me/643402985734254",   "id": "643402985734254"
}


Support sharesample URLs in Android

When a shared link is tapped your Android app is launched through the URL specified in the App Link object you just created (if you didn't specify a url, then it will use the canonical URL - i.e. the https://fb.me/xxxxx URL). To set up your app to respond to this URL, you need to add an intent filter in your app's manifest file.

The filter should respond to the applinkFB scheme (if you didn't specify a URL, then your filter should respond to the fb.me host and https scheme), handle implicit intents, and accept the ACTION_VIEW action. The example below adds an intent filter to the MainActivity that handles this:



    ...
    
        
        
        
        
    


Once you've set up your web pages based App Links, 
you're ready to handle incoming links to your app.

Handling incoming links

To ensure an engaging user experience, you should process the incoming intent information when your app is activated and direct the person to the object featured in the story they're coming from. 

For example, if I see a story on my Facebook feed about one of my friends completing this share tutorial and I tap on it, I will expect to be redirected to a view in your app that features this tutorial and not to your app's main activity.

If you use the App Links Hosting API, the Intent data will look like this:


data: "applinkFB://showApp/54eee6292658c7df25000004?target_url=https%3A%2F%2Ffb.me%2F643402985734299"
extras:
  al_applink_data: <Bundle containing App Link data>

In the code sample below, we're simply logging the target URL, but you should direct people through the appropriated flow for your app:


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(this); 
    ...
    Uri targetUrl =
      AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
    if (targetUrl != null) {
        Log.i("Activity", "App Link Target URL: " + targetUrl.toString());
    }
}

67 comments:

  1. thanks for sharing wonderful information from your blog. and great doing in this about coding. keep update more useful information.
    SEO Training in Chennai

    ReplyDelete

  2. Thank you for having taken your time to provide us with your valuable information relating to your stay with us.we are sincerely concerned.., Most importantly, you Keepit the major...
    hadoop Training in Chennai

    ReplyDelete
  3. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing.A very good resource for everybody that wants to read a good blog.

    Google App Integration Madurai

    ReplyDelete
  4. Wanna great article that very useful. All things which specify is a very interesting for read.SEO Company in
    Chennai

    ReplyDelete
  5. Great post.
    Thanks for sharing. Picked up some good and valuable insight.
    Android Training in Chennai

    ReplyDelete

  6. interesting blog. It would be great if you can provide more details about it. Thanks you

    Java and J2EE Training in Chennai - AmitySoft

    ReplyDelete
  7. good informative blog.I got some new techniques to link facebook with googles Api ,It really helps to teach our students in android development program Thanks for the post

    ReplyDelete
  8. Thanks for sharing, I will bookmark and be back again....Facebook app development

    ReplyDelete
  9. Thanks for sharing this informative articles ..glad to visit this blog.

    Best Linux Training in Chennai

    ReplyDelete
  10. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog, I will keep visiting this blog very often.
    Facebook

    ReplyDelete
  11. "Great post. Keep it up. Thanks for advice. It is wonderful information for me. "!!
    mobile app development framework

    ReplyDelete

  12. Wow.. Its really very good information Facebook app deep linking. I hope you will update more soon.Know more about Facebook app deep linking check out Magento Connector

    ReplyDelete
  13. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai




    ReplyDelete
  14. I simply want to say I’m very new to blogs and actually loved you’re blog site. Almost certainly I’m going to bookmark your blog post . You absolutely come with great well written articles. Thanks a lot for sharing your blog.
    Best Android Training in Velachery | android development course fees in chennai

    ReplyDelete
  15. This information is impressive; I am inspired by your post writing style & how continuously you describe this topic...Android Training in Bangalore

    ReplyDelete
  16. Very Informative! This blog is great source of information which is very useful for me. Thank you very much for sharing this!
    Excellent blog..Thanks for your ideas. android development company ludhiana

    ReplyDelete
  17. Wow, the application is very unique and I am looking forward to using it soon and understand how it functions. Thanks for sharing this important technological article with us. I have found it to be not only up to date but also informative. Students can access our professional literature review site by clicking on Well Analyzed Lit Reviews.

    ReplyDelete
  18. Thanks...Great information provided about Android Training . I appreciate your work.
    top android app development companies


    ReplyDelete
  19. This ARTICLE really helpful people to start the Android Development. I hope everyone using this to growing their business in public.

    Android training in Nagpur

    ReplyDelete
  20. Wow... great article that very useful. All things which specify is a very interesting for read.
    Interior Designers in Chennai
    Interiors in Chennai
    Good Interior Designers in Chennai

    ReplyDelete
  21. Awesome,
    Thank you so much for sharing such an awesome blog...Enem feels amazed

    ReplyDelete
  22. Nice blog..! I really loved reading through this article... Thanks for sharing such an amazing post with us and keep blogging...
    Feels free to get amazing update regarding GATE ,
    CBSE as well as on
    SSLC .

    ReplyDelete
  23. A nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
    Website Development Company Bangalore
    Website Design and Development Companies in Bangalore
    Outsource magento ecommerce services india

    ReplyDelete
  24. We will get all information regarding the Kerala SSLC results 2018kerala sslc resultsPlease click on this link

    ReplyDelete
  25. We will get all information regarding the Karnataka PUC results 2018puc resultsPlease click on this link


    Complete information regarding 2nd PUC Results 20182nd puc results 2018On a single click


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

    ReplyDelete
  27. We will get complete information of Tamilnadu HSC Results 2018tamilnadu hsc results 2018Just click on this link

    ReplyDelete
  28. We will get complete information of Tamilnadu SSLC Results 2018tamilnadu sslc results 2018Just click on this link

    ReplyDelete
  29. We will get complete and detailed information of Kerala Plus Two Results 2018Kerala Plus Two Results 2018On a simple on this link

    ReplyDelete
  30. We will get complete and detailed information of Kerala Plus Two Results 2018Kerala DHSC Results 2018On a simple on this link

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

    ReplyDelete
  32. This blog is very helpful for users who are looking for it. Thanks for sharing your thoughts on Android Online Training Bangalore

    ReplyDelete
  33. This is a perfect blog to learners who are looking for android technology, check it once at Android Online Training

    ReplyDelete
  34. The VAT has changed the system of business in UAE and most of the business trust over Audit Firms in Dubai to manage their updates yearly, monthly or even quarterly to achieve the target. Well, this year is so crucial and auditors in town are rushing to update the accounts even so fast and better manner. The leading Top 10 Audit Firm in UAE representing the honorable function over best auditing firm of this year in a surprising event.

    ReplyDelete
  35. 4th of July Images

    SSC CGL Result 2018

    Eid Mubarak Pics

    Jurassic World Fallen Kingdom

    Fathers day Pictures

    The Celebration of US Independence not only ends today, the celebration of July 4th continues the entire year and those who in need of happy 4th of July images for this year in HD format, please be in touch with us. We are here to help you in all kind of USA Independence day Images and Updates. check for recent updates of USA Independence at official website - USA 4th of july images




    The SSC Notification has arrived so earlier and due to the same, the official Tier Series by Update of SSC CGL Result 2018 will reflect the Calander date for this Year. However, aspirants can follow up the latest SSC Result notification on our portal - ssc.nic.in




    Ramadhan season has arrived, the new dresses, prayers, fasting has done. The people of the entire world are constituting to welcome their Eid and Latest thoughts like Eid Mubarak Wishes 2018 as well as Quotes, Greetings, images to their loved ones. You can check more updates about eid updates at - Eid HD Images



    The Animated character Dinausers are very much font to us. The Jurassic Park really thrilled in our childhood. The Jurassic world part 1 also very much excited. Today, the team come up with the blockbuster thriller Animated 2nd part to set it to release on June and the Jurassic World Fallen Kingdom Review can be read here from the top notch as we can. for more visit Jurassic world official jurassicworld.com


    The Fathers love is more than the thing that we tasted in this beautiful world. Here comes his day, celebrate the joyful occasion of fathers day with sending and inspiring him with Happy Fathers day images to make him tear that how u made him so valuable. for more collection of HD images searchFathers day Wallpapers

    ReplyDelete
  36. Very nice informative article about software and Service information, its very nice article. thanks for sharing such great article hope keep sharing such kind of article android app development

    ReplyDelete

  37. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it... Java Training in Chennai | Python Training in Chennai

    ReplyDelete
  38. big article on deep linking kindly visit my blog too about pnam orca error https://www.cdhpl.com/pname-com-facebook-orca/

    ReplyDelete
  39. Quick & Easy Steps To Resolve Pname Com Facebook Orca Error
    Pname com facebook orca is a major problem for many Facebook users. In this blog you will find quick & easily ways to solve Pname Com Facebook Orca Error

    ReplyDelete
  40. The blog was absolutely fantastic! Here Lots of great information. If you want to know more about Facebook App Development, then you can check out.

    ReplyDelete
  41. Thank you so much for the sharing it was useful and very informative. We're leading interior designers in chennai, we do all interior contract work.

    ReplyDelete
  42. Good post. Thank you for sharing.
    moviebox

    ReplyDelete
  43. This looks absolutely perfect. All these tiny details are made with lot of background knowledge. I like it a lot. 
    interior designers in chennai
    best interior designers in chennai

    ReplyDelete
  44. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...

    interior designers in chennai

    ReplyDelete
  45. I have picked cheery a lot of useful clothes outdated of this amazing blog. I’d love to return greater than and over again. Thanks! 
    best digital marketing company
    digital marketing agency in chennai
    digital marketing services
    website design company

    ReplyDelete
  46. You blog post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.
    interior designers in chennai

    ReplyDelete
  47. It is for the first that I just visited your site and I find it really interesting! Congratulations! please visit for latesetnews

    ReplyDelete
  48. Informative Blog.Social Media Marketing is one of the trending course in India.NIMS is one of the best Institution providing Digital Marketing Course in Thrissur.100% Placement Assistance along with Career Counselling is offered.Learn more about @ http://nimslearn.com/

    ReplyDelete