我的代码是:
String encodedData = Base64.encodeBytes("YxxxxxxxxxxxxxxxA".getBytes());
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
HttpClient client = new DefaultHttpClient(httpParams);
HttpPost request = new HttpPost("https://go.urbanairship.com/api/airmail/send/broadcast/");
//request.setHeader(header)
request.addHeader("Authorization", "Basic " + encodedData)
根据此处建议的文档,我正在使用应用程序主密码:
http://urbanairship.com/docs/richpush.html?highlight=broadcast
但我收到 401 未经授权的错误。
如何解决这个问题?
谢谢