コード例 #1
0
  public static void save(Context context, String username, String password) {
    // TODO Add encryption
    Credentials.get(context);
    credentials.username().put(username);

    String cred = Base64.encodeToString((username + ":" + password).getBytes(), Base64.DEFAULT);
    credentials.credentials().put(cred);
  }
コード例 #2
0
 public static String getHeader(Context context) {
   Credentials.get(context);
   String cred = credentials.credentials().get();
   Log.e("Auth", "Basic " + cred);
   return "Basic " + cred;
 }