app Token config

缥帙各舒散,前后互相逾。这篇文章主要讲述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(); } }

【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();
}
}














    推荐阅读