Android Open Source - UPPlatform_Android_SDK Api Headers






From Project

Back to project page UPPlatform_Android_SDK.

License

The source code is released under:

Apache License

If you think the Android project UPPlatform_Android_SDK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 * @author Omer Muhammed//  ww  w  . ja  v  a 2  s .  c o m
 * Copyright 2014 (c) Jawbone. All rights reserved.
 *
 */
package com.jawbone.upplatformsdk.api;

import retrofit.RequestInterceptor;

/**
 * Small class to dynamically add the required headers to the API calls.
 */
public class ApiHeaders implements RequestInterceptor {
    private String accessToken;

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public void clearAccessToken() {
        accessToken = null;
    }

    @Override
    public void intercept(RequestInterceptor.RequestFacade request) {
        if (accessToken != null) {
            request.addHeader("Authorization", "Bearer " + accessToken);
            request.addHeader("Accept", "application/json");
        }
    }
}




Java Source Code List

com.jawbone.helloup.HelloUpActivity.java
com.jawbone.helloup.UpApiListActivity.java
com.jawbone.upplatformsdk.api.ApiHeaders.java
com.jawbone.upplatformsdk.api.ApiManager.java
com.jawbone.upplatformsdk.api.RestApiInterface.java
com.jawbone.upplatformsdk.api.response.OauthAccessTokenResponse.java
com.jawbone.upplatformsdk.datamodel.DataCollection.java
com.jawbone.upplatformsdk.datamodel.Data.java
com.jawbone.upplatformsdk.datamodel.Links.java
com.jawbone.upplatformsdk.datamodel.Meta.java
com.jawbone.upplatformsdk.oauth.OauthUtils.java
com.jawbone.upplatformsdk.oauth.OauthWebViewActivity.java
com.jawbone.upplatformsdk.utils.UpPlatformSdkConstants.java