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的主要内容,如果未能解决你的问题,请参考以下文章

[异常解决] Keil安装好nRF51822开发环境,运行DEMO报错:Error:“GPIOTE_CONFIG_NUM_OF_LOW_POWER_ENVENTS” is undefined(代码片段

炼狱—Bug集中营

read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) { errno: -4077(代码片段

add application window with unknown token XXX Unable to add window;is your activity is running?(代码片段

add application window with unknown token XXX Unable to add window;is your activity is running?(代码片段

Vue3 在Axios中添加数据来自于sessionStorage的请求头(请求头添加token)