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.

https://dev.twitter.com/cards/mobile

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
<html>
<head> 
<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="http://app_name.vm39.sa92.info/ico.png">
<meta name="twitter:url" content="http://appname.com/">
<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" />
</head>
<body>
<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>
</body>
</html>

We have used summary card here.
https://dev.twitter.com/cards/types/summary
https://dev.twitter.com/cards/types/app

After making card, you have to validate your card with below URL.
https://cards-dev.twitter.com/validator

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.

AndroidManifest.xml

 <activity

            android:name=".ui.activities.SplashActivity"

            android:label="@string/app_name"

            android:launchMode="singleTop"

            android:screenOrientation="sensorPortrait"

            android:windowSoftInputMode="adjustResize" >

            <intent-filter>

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

            </intent-filter>

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

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


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

                <data

                    android:host="show"
                    android:scheme="appname" >

                </data>

            </intent-filter>
        </activity> 



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.

onCreate() 
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,
                                getIntent().getData().toString().length());



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




 
 

97 comments:

  1. Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete

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

    ReplyDelete
  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

    ReplyDelete
  4. 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

    ReplyDelete

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

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

    ReplyDelete

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

    ReplyDelete
  8. 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

    ReplyDelete
  9. 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.
    ANDROID TRAINING IN NOIDA

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

    Android App Development

    ReplyDelete
  11. 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

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

    ReplyDelete
  13. 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

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

    ReplyDelete

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

    ReplyDelete

  16. 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
  17. 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

    ReplyDelete
  18. 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 content.android development course fees in chennai | android app development training in chennai

    ReplyDelete
  19. 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

    ReplyDelete
  20. 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

    ReplyDelete
  21. 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!

    ReplyDelete
  22. 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

    ReplyDelete

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

    Installment loans
    Payday loans
    Title loans

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

    ReplyDelete
  25. 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

    ReplyDelete

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

    ReplyDelete
  27. Twigs Technologies is a leading company in the development of applications for Android. Development of Android applications Being the core of today's mobile strategy, we are helping global companies develop and implement the best Android class applications to keep them before the curve. Not only do we develop excellent Android applications, but we also support it in terms of marketing and monetization applications. With a ready-to-use framework and a strong team of Android application developers, we are rapidly developing the application and deploying the project according to the planned schedule.
    Android App Development in Gurgaon

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

    ReplyDelete
  29. This is very informative blog check it once through Android Online Training Bangalore for more information on android development.

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

    ReplyDelete
  31. 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 web desgin company in chennai

    ReplyDelete
  32. Australia Best Tutor is offer excellent my assignment help to the students. The quality of the Management Assignment Help Tasmania provided by them is truly exceptional.

    Read More @

    My Assignment Help NSW
    Management Assignment Help Tasmania

    Live Chat @

    https://www.australiabesttutor.com/management-project-assignment-help

    ReplyDelete
  33. My Genius Mind is a renowned academic portal that offers impressive academic support to the students.
    Live Chat @ https://www.mygeniusmind.com/
    Read More @
    Western Australia Assignment Help
    Writing Services Melbourne
    Australia Best Tutor
    Hobart Tasmania Assignment Help

    ReplyDelete
  34. My Genius Mind is a reputed educational facility providing portal that has been offering high-end Assignment Services Melbourne solutions.
    Live Chat @ https://www.mygeniusmind.com/new-south-wales-assignment-help

    Read More @ Brisbane Queensland Assignment Help
    Instant Assignment Help Tasmania
    Business Management Assignment Help

    ReplyDelete
  35. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.

    rpa Training in Chennai

    rpa Training in bangalore

    rpa Training in pune

    blueprism Training in Chennai

    blueprism Training in bangalore

    blueprism Training in pune

    iot-training-in-chennai

    ReplyDelete

  36. I am really happy with your blog because your article is very unique and powerful for new reader.
    Click here:
    Selenium Training in Chennai | Selenium Training in Bangalore | Selenium Training in Pune | Selenium online Training

    ReplyDelete
  37. Thank you for your informative post keep sharing the valuable information like this..


    Digital marketing companies in bangalore | Mobile app development companies in bangalore

    ReplyDelete
  38. hi, great post. It was really useful to read your blog. Thanks for it, keep updating!

    DevOps Online Training

    ReplyDelete
  39. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience. Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in
    python Online training in chennai
    python Online training in bangalore
    python interview question and answers

    ReplyDelete
  40. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    rpa training in bangalore
    best rpa training in bangalore
    rpa training in pune | rpa course in bangalore
    rpa training in chennai

    ReplyDelete
  41. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Best Devops Training in pune
    Devops Training in Bangalore
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  42. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Best Travels in Madurai | Tours and Travels in Madurai | Madurai Travels

    ReplyDelete
  43. DIAC providing Industrial Automation Training in PLC SCADA, Robotics and registration started few seats are left. So, what are you waiting for book your seat @ +91-99534-89987, +91-97112-87737.

    ReplyDelete
  44. This is quite educational arrange. It has famous breeding about what I rarity to vouch.
    Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved.
    This arrange is synchronous s informative impolite festivity to pity. I appreciated what you ok extremely here.


    Selenium interview questions and answers
    Selenium Online training
    Selenium training in Pune
    selenium training in USA
    selenium training in chennai

    ReplyDelete
  45. Nice post. The blog is very useful to write and also easy to understand. Thank you for sharing the information.
    moviebox application
    show box

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

    ReplyDelete
  47. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    blue prism Training in Electronic City

    ReplyDelete
  48. Thank you for sharing such a nice post!

    Looking for Best Training Institute in Bangalore , India. Softgen Infotech is the best one to offers 85+ computer training courses including IT Software Course in Bangalore , India. Also, it provides placement assistance service in Bangalore for IT.

    ReplyDelete
  49. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.Prathima Infotech training center bangalore

    ReplyDelete

  50. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.Prathima Infotech training center bangalore

    ReplyDelete
  51. Thanks for sharing this blog. This very important and informative blog.Become a Trainer

    ReplyDelete
  52. Learned a lot of new things from your post! Good creation and HATS OFF to the creativity of your mind.Student Reviews

    ReplyDelete
  53. Thanks for sharing this blog. This very important and informative blog. content










    ReplyDelete
  54. Really i appreciate the effort you made to share the knowledge. The topic here i found was really effective...

    Learn SAP from the Industry Experts we bridge the gap between the need of the industry. eTechno Soft Solutions provide the Best IT Training in Bangalore .

    ReplyDelete
  55. Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge. Real Time Experts training center bangalore

    ReplyDelete
  56. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.Real Time Experts Training in Bangalore

    ReplyDelete
  57. Great post!I am actually getting ready to across this information,i am very happy to this commands.Also great blog here with all of the valuable information you have.Well done,its a great knowledge.student review for Realtime Experts marathahalli bangalore

    ReplyDelete
  58. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site. Real Time Experts Training in Bangalore center address bangalore

    ReplyDelete
  59. Nice post. It is really interesting. Thanks for sharing the post!
    Buy AC Online | Smart LED TV
    Laptops for Sale | Best Inverter AC | Sathya Online

    ReplyDelete
  60. Good Post!, it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
    AngularJS Online Training

    ReplyDelete
  61. Good Post! it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article, I want to say that also a well-written article with some very good information which is very useful for the AWS Cloud Practitioner Online Training

    ReplyDelete
  62. Thanks for giving a wonderful article. If you want to promote your blog page or your product or your business then go for bulk sms service Chennai, they provide the best bulk sms service.

    bulk sms in bangalore | bulk sms explicit Bangalore | promotional sms provider | bulk sms reseller mysuru | SMS API | bulk sms gateway | sms implicit

    ReplyDelete
  63. In this platform, there is the easiest way to enter into a wonderland of a Gangsters clan if you are really an adrenaline junkie or adventure and thrill-loving person. GTA San Andreas mod apk can now be played for free with just a few guidelines to follow by an adventure-loving person.

    https://apkmodule.com/gta-san-andreas-mod-apk/

    ReplyDelete
  64. Thanks for the valuable feedback. If you want the most cost-effective bulk sms service in chennai to reach your customer. Don't worry here plenty of companies provide bulk sms for businesses or individuals. Search transactional bulk sms, you can get a lot of answers.

    Transactional SMS Chennai
    OTP SMS
    Service Implicit Coimbatore

    ReplyDelete