Android Open Source - localbitcoinslibrary Access Token






From Project

Back to project page localbitcoinslibrary.

License

The source code is released under:

GNU General Public License

If you think the Android project localbitcoinslibrary 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

package com.stealthcopter.localbitcoinslibrary.Objects;
/*ww  w  .  j a  v a  2s .co  m*/
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created with IntelliJ IDEA.
 * User: mat
 * Date: 11/07/13
 * Time: 23:36
 * To change this template use File | Settings | File Templates.
 */
public class AccessToken {
    public String access_token;
    public String refresh_token;
    public String expires_in;

    // JSON Keys
    private static final String JSON_ACCESS_TOKEN="access_token";
    private static final String JSON_EXPIRES_IN="expires_in";
    private static final String JSON_REFRESH_TOKEN = "refresh_token";

    public AccessToken(JSONObject json) throws JSONException{
            // All fields are required, so we will throw an exception if not found
            access_token = json.getString(JSON_ACCESS_TOKEN);
            refresh_token = json.getString(JSON_REFRESH_TOKEN);
            expires_in = json.getString(JSON_EXPIRES_IN);
    }

    public JSONObject toJSON(){
        JSONObject json = new JSONObject();
        try {
            json.put(JSON_ACCESS_TOKEN, access_token);
            json.put(JSON_REFRESH_TOKEN, refresh_token);
            json.put(JSON_EXPIRES_IN, expires_in);
            return json;
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

}




Java Source Code List

com.stealthcopter.LocalBitcoinSample.App.java
com.stealthcopter.LocalBitcoinSample.EscrowActivity.java
com.stealthcopter.LocalBitcoinSample.LoginActivity.java
com.stealthcopter.LocalBitcoinSample.StartActivity.java
com.stealthcopter.localbitcoinslibrary.LocalBitcoinAction.java
com.stealthcopter.localbitcoinslibrary.Objects.AccessToken.java
com.stealthcopter.localbitcoinslibrary.Objects.Escrow.java