app Token config

Posted halo-漾

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了app Token config相关的知识,希望对你有一定的参考价值。

public class Config {
    private static final String TOKEN_KEY = "token";
    private static final String APP_ID = "com.jiangcun.secret";
    public static String getCacheToken(Context context){
        return context.getSharedPreferences(APP_ID , Context.MODE_PRIVATE).getString(TOKEN_KEY,null);
    }

    public static void cacheToken(Context context,String token){
        SharedPreferences.Editor editor = context.getSharedPreferences(APP_ID,Context.MODE_APPEND).edit();
        editor.putString(TOKEN_KEY,token);
        editor.commit();
    }
}

 

public class Config {
private static final String TOKEN_KEY = "token";
private static final String APP_ID = "com.jiangcun.secret";
public static String getCacheToken(Context context){
return context.getSharedPreferences(APP_ID , Context.MODE_PRIVATE).getString(TOKEN_KEY,null);
}

public static void cacheToken(Context context,String token){
SharedPreferences.Editor editor = context.getSharedPreferences(APP_ID,Context.MODE_APPEND).edit();
editor.putString(TOKEN_KEY,token);
editor.commit();
}
}












以上是关于app Token config的主要内容,如果未能解决你的问题,请参考以下文章