Wednesday, 4 November 2015

Twitter- Deep Linking with Android

Twitter - Deep Linking for Mobile Developers

The App Card provides the ability for users to download your app (if the user doesn’t already have it installed), or deep-link into your own app (if the app is already installed on the user’s mobile device).
We can achieve this things with Twitter Card.

We need to make dynamic Web page and host this page on any server which will be use for Sharing using Twitter from app. 

For demonstration purpose, we have implemented the same functionality in PHP with some hard-coded data but you need to convert in your back-end technology with dynamic data.

Please find PHP source code which we used for testing purpose.

Web Page Part
<title>App Name</title>
<meta name="twitter:card" content="summary">

<meta name="twitter:site" content="App Name">
<meta name="twitter:title" content="App Name">

<meta name="twitter:description" content="App Name is a 100% free social sharing app that allows sharing of video, photo, audio and text all in one network.">
<meta name="twitter:image" content="">
<meta name="twitter:url" content="">
<meta name="twitter:app:name:iphone" content="appname"/>
<meta name="twitter:app:id:iphone" content="570281083"/>
<meta name="twitter:app:name:googleplay" content="appname"/>
<meta name="twitter:app:id:googleplay" content="com.appname"/>
<meta name="twitter:app:url:iphone" content="appname://show?bid=54e58b4360afd71a53001f5e" />
<meta name="twitter:app:url:googleplay" content="appname://show?bid=54e58b4360afd71a53001f5e" />
<h1>Have something interesting here for particular Post, becasue when user click on link from Twitter it he/she will come to this page.</h1>

We have used summary card here.

After making card, you have to validate your card with below URL.

Android Part

At Android side, we need to do below things.
We need to add host and scheme in activity tag of Manifest file based on url defined in twitter app link url above.

Please find below code snippets below for reference.







            android:windowSoftInputMode="adjustResize" >


                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />


            <intent-filter android:label="@string/app_name" >

                <action android:name="android.intent.action.VIEW" >
                <category android:name="android.intent.category.DEFAULT" >
                <category android:name="android.intent.category.BROWSABLE" >

                <!-- Accepts URIs that begin with "example://action" -->


                    android:scheme="appname" >



In Activity, You can retrieve app link url in oncreate() method.
With url, you can redirect user to our app's screen based on data retrieved from URL.

Please find below code snippets below for reference.

if (getIntent().getData() != null

                && getIntent().getData().toString().length() > 0) {

            Logs.e(TAG, "Data:" + getIntent().getData());

        if (getIntent().getData().toString().startsWith("appname")) {

                twitterCallbackUrl = getIntent().getData().toString()
                        .substring(getIntent().getData().toString().lastIndexOf("?bid=") + 5,

                Logs.e(TAG, "twitterCallbackUrl:" + twitterCallbackUrl);



  1. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.

    SEO Company in Chennai

  2. Perfect!!! What I can say in this article is very important to be written as it may help everybody to get awareness. Good job done.Android Training in Noida

  3. Perfect!!! What I can say in this article is very important to be written as it may help everybody to get awareness. Good job done.Android Training in Noida


  4. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.

    Online Reputation Management

  5. Awesome informative article..Thank you Ankit..Nice stuff ! But it is not passing data through scheme properly .
    Mobile App Development Company in Jaipur


  6. Thank you for the info. It sounds pretty user friendly. I guess I’ll pick one up for fun. thank u

    Android App Development Training in Chennai

  7. Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.

    SAP ABAP Training in Chennai

  8. Hi... Ankit.. I have read your blog and it is like others of your great blogs. You always write an impressive post. A fabulous blog.

  9. It is nice post and I found some interesting information on this blog, keep it up. Thanks for sharing.

    Android App Development

  10. Nice it seems to be good post... It will get readers engagement on the article since readres engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

  11. hi Ankit Thakkar thanks for sharing Twitter- Deep Linking with Android concept. very interesting topic for sharing.keep sharing on andriod updated tutorials.......

  12. A very well-written post. I read and liked the post and have also bookmarked you. All the best for future endeavors. Getting some solution regarding.
    UI Designing Company in Bangalore, Web Application Development Companies in Bangalore

  13. Good Information I like this blogs Techavera Noida Also provides Android Training in Noida.


  14. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
    Mobile App Development Company
    Mobile App Development Companies


  15. 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

  16. Nice one..very useful for an individual web designers or any web designing company as well. I think if I am not wrong, it would be worth enough for all web design companies

  17. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving... very specific nice development course fees in chennai | android app development training in chennai

  18. Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.
    Android training in chennai with placement | Android Training in chennai

  19. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...

    Android App Development Company

  20. Having read this I believed it was very enlightening. I appreciate you spending some time and effort to put this information together on Internship in Gurgaon NCR as it give you a Mention Duration of Training clues about corporate working culture. it was still worthwhile!

  21. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    Web Design Development Company
    Web design Company in Chennai
    Web development Company in Chennai


  22. Its very useful to me. Wonderful blog.. Thanks for sharing informative Post.

    Installment loans
    Payday loans
    Title loans

  23. it is really amazing...thanks for sharing....provide more useful information...
    Mobile app development company

  24. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Installment Loans Near Me
    Title loans Near Me
    Cash Advances Near Me