Master plugin

Master Maven plugin for adding Squencing.com's Real-Time Personalization technology to Android and Java apps

License

License

GroupId

GroupId

com.sequencing
ArtifactId

ArtifactId

master-plugin
Last Version

Last Version

1.0.30
Release Date

Release Date

Type

Type

aar
Description

Description

Master plugin
Master Maven plugin for adding Squencing.com's Real-Time Personalization technology to Android and Java apps
Project URL

Project URL

https://github.com/SequencingDOTcom/Maven-Android-Master-Plugin-Java
Source Code Management

Source Code Management

https://github.com/SequencingDOTcom/Maven-Android-Master-Plugin-Java

Download master-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/com.sequencing/master-plugin/ -->
<dependency>
    <groupId>com.sequencing</groupId>
    <artifactId>master-plugin</artifactId>
    <version>1.0.30</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.sequencing/master-plugin/
implementation 'com.sequencing:master-plugin:1.0.30'
// https://jarcasting.com/artifacts/com.sequencing/master-plugin/
implementation ("com.sequencing:master-plugin:1.0.30")
'com.sequencing:master-plugin:aar:1.0.30'
<dependency org="com.sequencing" name="master-plugin" rev="1.0.30">
  <artifact name="master-plugin" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.sequencing', module='master-plugin', version='1.0.30')
)
libraryDependencies += "com.sequencing" % "master-plugin" % "1.0.30"
[com.sequencing/master-plugin "1.0.30"]

Dependencies

compile (4)

Group / Artifact Type Version
com.sequencing : appchains jar 1.0.5
com.sequencing : android-oauth jar 1.0.19
com.android.support » appcompat-v7 jar 23.2.1
com.sequencing : file-selector jar 1.0.27

Project Modules

There are no modules declared in this project.

Master Gradle and Maven plugin for adding Squencing.com's Real-Time Personalization (+RTP) API to Android and Java apps

This Master Gradle and Maven plugin can be used to quickly add Real-Time Personalization to your app. This Master Plugin contains a customizable, end-to-end plug-n-play solution that quickly adds all necessary code (OAuth2, File Selector and App Chain coding) to your app.

Once this Master Plugin is added to your app all you'll need to do is:

  1. add your OAuth2 secret
  2. add one or more App Chain numbers
  3. configure your app based on each app chain's possible responses

To code Real-Time Personalization technology into apps, developers may register for a free account at Sequencing.com. App development with RTP is always free.

The Master Plugin is also available in the following languages:

Master Plugin - Plug-n-Play Samples (This code can be used as an out-of-the-box solution to quickly add Real-Time Personalization technology into your app):

Contents

  • Implementation
  • Master Gradle plugin integration
  • OAuth Gradle plugin integration
  • File selector Gradle plugin integration
  • App chains
  • Authentication flow
  • Steps
  • Resources
  • Maintainers
  • Contribute

Implementation

To implement this Master Plugin for your app:

  1. Register for a free account

  2. Add this Master Plugin to your app

  3. Generate an OAuth2 secret and insert the secret into the plugin

  4. Add one or more App Chain numbers. The App Chain will provide genetic-based information you can use to personalize your app.

  5. Configure your app based on each app chain's possible responses

Master Gradle plugin integration

  • see gradle guides
  • include dependency into build.gradle file in dependencies section. Here is dependency declaration example:
     dependencies {
    		compile 'com.sequencing:master-plugin:1.0.32' 
     }
    
  • integrate OAuth Gradle plugin
  • integrate File selector Gradle plugin
  • integrate AppChains Gradle plugin

OAuth Gradle plugin integration

You need to follow instructions below if you want to build in and use OAuth logic in your existing or new project.

  • create a new Android Gradle based project (i.e. in Android Studio or Eclipse)

  • add gradle dependency

    • see gradle guides
    • add dependency into build.gradle file in dependencies section. Here is dependency declaration example:
     dependencies {
    		compile 'com.sequencing:android-oauth:1.0.22' 
     }
    
  • integrate autherization functionality

    • add imports
     import com.sequencing.androidoauth.core.OAuth2Parameters;
     import com.sequencing.androidoauth.core.ISQAuthCallback;
     import com.sequencing.androidoauth.core.SQUIoAuthHandler;
     import com.sequencing.oauth.core.Token;
    • for authorization you need to specify your application parameters at AuthenticationParameters. Authorization plugin use custom url schema which you should define. For example:
    AuthenticationParameters parameters = new AuthenticationParameters.ConfigurationBuilder()
                .withRedirectUri("[your custom url schema]/Default/Authcallback")
                .withClientId("[your client id]")
                .withClientSecret("[your client secret]")
                .build();
     /**
     * Callback for handling success authentication
     * @param token token of success authentication
     */
    void onAuthentication(Token token);
    
    /**
     * Callback of handling failure authentication
     * @param e exception of failure
     */
    void onFailedAuthentication(Exception e);
    • create View that will serve as initial element for authentication flow. It can be a Button or an extension of View class. Do not define onClickListener for this View.
    • create SQUIoAuthHandler instance that is handling authentication process
    • register your authentication handler by invoking authenticate method with view, callback and app configuration
    public void authenticate(View viewLogin, final ISQAuthCallback authCallback, AuthenticationParameters parameters);

File selector Gradle plugin integration

You need to follow instructions below if you want to build in and use OAuth logic in your existing or new project.

  • create a new Android Gradle based project (i.e. in Android Studio or Eclipse)

  • File selector module prepared as separate module, but it depends on a SequencingOAuth2Client instance from oAuth module. File selector can execute request to server for files with SequencingOAuth2Client instance only. Thus you need 2 modules to be installed: oAuth module and File Selector module

  • add gradle dependency

    • see gradle guides
    • include the listed below dependency into build.gradle file in dependencies section. Here is dependency declaration example:
     dependencies {
    		compile 'com.sequencing:file-selector:1.0.30'
     }
    
  • integrate autherization functionality

    • add imports
     import com.sequencing.androidoauth.core.OAuth2Parameters;
     import com.sequencing.fileselector.core.ISQFileCallback;
     import com.sequencing.fileselector.core.SQUIFileSelectHandler;
     import com.sequencing.oauth.core.Token;
    
  • oAuth Gradle plugin. See reference: Maven-Android-OAuth-Java

  • integrate file selector functionality

      /**
      * Callback for handling selected file
      * @param entity selected file entity
      * @param activity activity of file selector
      */
     void onFileSelected(FileEntity entity, Activity activity);
    
    • create SQUIFileSelectHandler instance that is handling file selection process

    • register your file selection handler by invoking selectFile method

    • when you invoke selectFile method will be started file selector UI

    • when user selects any file and clics on "Continue" button in UI will be invoked user ISQFileCallback implementation and passed to him FileEntity object and current file selector activity

    • each file is represented as FileEntity object with following keys and values format:

      key name type description
      DateAdded String date file was added
      Ext String file extension
      FileCategory String file category: Community, Uploaded, FromApps, Altruist
      FileSubType String file subtype
      FileType String file type
      FriendlyDesc1 String person name for sample files
      FriendlyDesc2 String person description for sample files
      Id String file ID
      Name String file name
      Population String
      Sex String the sex
  • examples

    • example of File selector UI

    my files

    • example of Select File button

    Button btnFileSelector = (Button)findViewById(R.id.btnFileSelector);

    SQUIFileSelectHandler fileSelectHandler = new SQUIFileSelectHandler(this);

    • example of selectFile method
     fileSelectHandler.selectFile(OAuth2Parameters.getInstance().getOauth(), new ISQFileCallback() {
    
                     @Override
                     public void onFileSelected(FileEntity entity, Activity activity) {
                         Log.i(TAG, "File has been selected");
    
                         Toast toast = Toast.makeText(getApplicationContext(), entity.toString(), Toast.LENGTH_LONG);
                         toast.show();
                     }
                 }, true, null);
    

App chains

Search and find app chains -> https://sequencing.com/app-chains/

Each app chain is composed of

  • an API request to Sequencing.com
  • this request is secured using oAuth2
  • analysis of the app user's genes
  • each app chain analyzes a specific trait or condition
  • there are thousands of app chains to choose from
  • all analysis occurs in real-time at Sequencing.com
  • an API response to your app
  • the information provided by the response allows your app to tailor itself to the app user based on the user's genes.
  • the documentation for each app chain provides a list of all possible API responses. The response for most app chains are simply 'Yes' or 'No'.

Example

  • App Chain: It is very important for this person's health to apply sunscreen with SPF +30 whenever it is sunny or even partly sunny.
  • Possible responses: Yes, No, Insufficient Data, Error

While there are already app chains to personalize most apps, if you need something but don't see an app chain for it, tell us! (ie email us: [email protected]).

Authentication flow

Sequencing.com uses standard OAuth approach which enables applications to obtain limited access to user accounts on an HTTP service from 3rd party applications without exposing the user's password. OAuth acts as an intermediary on behalf of the end user, providing the service with an access token that authorizes specific account information to be shared.

![Authentication sequence diagram] (https://github.com/SequencingDOTcom/oAuth2-code-and-demo/blob/master/screenshots/oauth_activity.png)

Steps

Step 1: Authorization Code Link

First, the user is given an authorization code link that looks like the following:

https://sequencing.com/oauth2/authorize?redirect_uri=REDIRECT_URL&response_type=code&state=STATE&client_id=CLIENT_ID&scope=SCOPES

Here is an explanation of the link components:

  • https://sequencing.com/oauth2/authorize: the API authorization endpoint
  • client_id=CLIENT_ID: the application's client ID (how the API identifies the application)
  • redirect_uri=REDIRECT_URL: where the service redirects the user-agent after an authorization code is granted
  • response_type=code: specifies that your application is requesting an authorization code grant
  • scope=CODES: specifies the level of access that the application is requesting

login dialog

Step 2: User Authorizes Application

When the user clicks the link, they must first log in to the service, to authenticate their identity (unless they are already logged in). Then they will be prompted by the service to authorize or deny the application access to their account. Here is an example authorize application prompt

grant dialog

Step 3: Application Receives Authorization Code

If the user clicks "Authorize Application", the service redirects the user-agent to the application redirect URI, which was specified during the client registration, along with an authorization code. The redirect would look something like this (assuming the application is "php-oauth-demo.sequencing.com"):

https://php-oauth-demo.sequencing.com/index.php?code=AUTHORIZATION_CODE

Step 4: Application Requests Access Token

The application requests an access token from the API, by passing the authorization code along with authentication details, including the client secret, to the API token endpoint. Here is an example POST request to Sequencing.com token endpoint:

https://sequencing.com/oauth2/token

Following POST parameters have to be sent

  • grant_type='authorization_code'
  • code=AUTHORIZATION_CODE (where AUTHORIZATION_CODE is a code acquired in a "code" parameter in the result of redirect from sequencing.com)
  • redirect_uri=REDIRECT_URL (where REDIRECT_URL is the same URL as the one used in step 1)

Step 5: Application Receives Access Token

If the authorization is valid, the API will send a JSON response containing the access token to the application.

Resources

Maintainers

This repo is actively maintained by Sequencing.com. Email the Sequencing.com bioinformatics team at [email protected] if you require any more information or just to say hola.

Contribute

We encourage you to passionately fork us. If interested in updating the master branch, please send us a pull request. If the changes contribute positively, we'll let it ride.

com.sequencing

Sequencing.com

The App Store for your DNA

Versions

Version
1.0.30
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0