Giter VIP home page Giter VIP logo

streamhub-android-sdk's Introduction

StreamHub-Android-SDK

Make Android apps powered by Livefyre StreamHub

Read the docs: http://livefyre.github.com/StreamHub-Android-SDK/

Getting Started

The Gradle build needs to be configured with the location of the Android SDK. Create a file called local.properties and point to your install as follows:

sdk.dir = /your_android_sdk_path

Depending on your development environment, build the library as follows:

Gradle/Android Studio

Run ./gradlew install and add the following to your build.gradle:

dependencies {
    compile 'com.livefyre:StreamHub-Android-SDK:0.0.1'
}

Other environments

Run gradle build and include the built .aar file in build/libs/

Running the examples

Each example has its own Gradle build and depends on the core library being installed. Run gradle install to install the library in the local Maven repo if you haven't done so already.

The examples also have hard-coded values for the article and user token values. Replace the hard-coded values with values appropriate to your application.

To build an example project, run gradle build in that project's directory (e.g. examples/commentstream).

The project can be run through Android Studio or from the command-line as follows (using the commentstream example):

/<PATH TO SDK INSTALL>/sdk/platform-tools/adb install build/apk/commentstream-debug-unaligned.apk

Building an application

Environment Configuration

By default, the library uses the Livefyre production environment. To configure it for the UAT environment, add Config.environment = "t402.livefyre.com"; to your application instantiation.

Authentication

The first step in building an application will be to authenticate a user. Information (including a sequence diagram) on how to construct an LFToken can be found here.

Retrieving Collections and New Data

The BootstrapClient is used to retrieve initial data for a collection. To stream new data, use the StreamClient. Implementations should continue to long poll via the stream client to keep data flowing to their application in real time.

Sending Data to Livefyre

The WriteClient is used to send data to Livefyre (like, new comments, etc). All methods require a user token. Responses to actions sent via the WriteClient will be sent directly back. They will also be sent down via the StreamClient, so be sure to check for duplicate content.

Clients

At the time of writing, the StreamHub Android SDK exposes classes for requesting and sending to the StreamHub APIs. It make no assumptions viewing the content.

  • BootstrapClient - Get recent Content and metadata about a particular Collection

  • PublicAPIClient - Request the Hottest Collections in a Network or get recent Content from a specific user

  • StreamClient - Poll a Collection to retrieve new, updated, and deleted Content when it becomes available.

  • WriteClient - Post Content, flag Content, like/unlike Content in a Collection. User authentication tokens will generally be required to use methods in this class.

streamhub-android-sdk's People

Contributors

gobengo avatar jjjjw avatar ross-pfahler avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.