170 likes | 186 Views
This guide explores social networks integration in Android apps for Facebook, Twitter, Google Plus, and Fabric kit. Learn common methodologies, login procedures, SDK integration, permissions, and more, with detailed examples and useful tools for seamless integration.
E N D
Social Networks Integration in Android by Gianluigi Folino
Social Networks Integration in Android Motivation Common Methodologies Facebook and Facebook login Facebook Graph Twitter Fabric kit Google Plus and other social networks
Motivation Everybody uses one or more social networks. We do not need to develop API for Facebook and Twitter from scratch. Most of mobile applications have strong or light interactions with social networks
Common Methodologies Most of the social networks have the same method for integration in an Android app. Connect to a developer page (i.e., https://developers.facebook.com/) Generate a token Use the token into the android application and set the appropriate permissions Finally, the user authorizes the application to connect to his/her account.
Facebook • Facebook • First social network for n° of active users. (1.55 billiards of active users –November 2015) • «Social Plugins: Social plugins permit to see what your friends share, like, comment, etc. [Facebook Social Plugins, http://developers.facebook.com/docs/plugins/] • Like button; • Comment; • Facebook is a social graph: “The social graph is a contextual sociogram that describes all the members, organizations, groups and other user-end components of a social network and the relation/connection between them. A social graph helps to illustrate and map the overall structure and interrelation of social network members..” [What is the Social Graph - Techopedia, http://www.techopedia.com/definition/15618/social-graph]
Facebook • Facebook Login • Sharing on Facebook • https://developers.facebook.com/docs/sharing/android • Account kit • Social Plugin • Facebook Analytics https://developers.facebook.com/products/analytics/ • Monetization (now Audience Network)
Facebook Login (1) • Login and Access Token For evident privacy issues, the calls to Facebook must be protected. • Access Token: a string identifying and protecting a user • Login flow: • Connect to Facebook; • Exchange security codes; (OAUTH 2.0 Protocol) 3. Get the access token.
Facebook Login (2) Facebook App - Configured and linked to your app, with Single Sign On enabled. Facebook SDK - Added to your project, see Getting Started, Facebook Android SDK. Facebook App ID - Configure and link this to your Android app. See Android Getting Started, Add Facebook App ID (you find it in: /developers.facebook.com/apps -> your app) Android Key Hash - Generate this and add it to your developer profile Facebook Activity - Include this in AndroidManifest.xml Permissions Review. (test Application avoid the Permission review.)
Social Plugin See what your Facebook friends liked, shared, or commented on across the Web. Like, Share & Send Button Embedded Posts & Video Player Page Plugin (New Like Box) Comments Follow Button
Graph API (1) • Social Graph: • nodes - basically "things" such as a User, a Photo, a Page, a Comment. • edges - the connections between those "things", such as a Page's Photos, or a Photo's Comments • fields - info about those "things", such as a person's birthday, or the name of a Page
Graph API (2) • Graph API • Low level API based on HTTP calls, permit to query data, post new stories, manage ads, upload photos, etc. • Based on the social graph concept. • Most Graph API requests require the use of access tokens. • Each node has a unique ID which is used to access it via the Graph API. • Use the Graph API Explorerto simulate how the API works and to get the code for the App. • Remember to get User Access Token before and give the appropriate permissions. Examples (permissions: user_posts, user_photos): /me/friends?limit=25&offset=0&fields=id,name,work,email /me?fields=albums.limit(5){name, photos.limit(2)},posts.limit(5)
facebook-android-sdk Tutorial: http://www.theappguruz.com/blog/android-facebook-integration-tutorial API for FB by FB targeting Android https://github.com/facebook/facebook-android-sdk Facebook Application ID must be set for developing any mobile app. with this SDK http://www.facebook.com/developers/createapp.php
Twitter integration: obsolete API Unofficial Java library for the Twitter API: Twitter4jhttp://twitter4j.org Java library for the Twitter API: Jtwitterhttp://www.winterwell.com/software/jtwitter.php Open Source Project hosted on githhub: Twitter-Android-sdkhttps://github.com/sugree/twitter-android-sdk
Twitter integration: Fabric https://docs.fabric.io/android/index.html Ide plugin for Android Studio and Eclipse or manual integration. Fabric Kits: Answers (real-time analytics), Crashlytics(stability and reliability of the apps), MoPub (monetizing our app by adding advertisements), Stripe(mobile payments) and Twitter (real Twitter integration, login, sharing, etc.).
Fabric Tutorials: https://docs.fabric.io/android/examples/cannonball/index.html https://dev.twitter.com/mopub/android Other tutorials http://www.tutorialspoint.com/android/android_twitter_integration.htm
Google Plus integration https://developers.google.com/+/mobile/android/ Integrating Google Plus into Android App Integrating Google Sign-In Sharing to Google Plus Getting People Information