Androidでapachehttpクライアントを使用していたときに、logcatに疑わしいメッセージが表示されました。
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) NafHttpAuthStrategyDefault()
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) cached value : gbaSupportIsPossible=null
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) The current context is NOT a context of GBA service.
I/APACHE HTTP (thCr=2252) - GbaSupportPermissionRequestCheckerImpl(9949): (thUse=2252) isCurrentProcessRequestedGba()#finished result=false
I/APACHE HTTP (thCr=2252) - GbaSupportPermissionRequestCheckerImpl(9949): (thUse=2252) isCurrentProcessAllowedToUseGba()#started result=false
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) The GBA permission wasn't requested for this process.
I/APACHE HTTP (thCr=2252) - NafHttpAuthStrategyDefault(9949): (thUse=2252) It is impossible to support GBA now (many possible reasons: no Android Context, current client is GBA service, etc.), then it will be just usual HTTP.
I/APACHE HTTP (thCr=2252) - NafRequestExecutorWrapperRedirectionHandler(9949): (thUse=2252) It isn't GBA flow, redirection responses are not handled.
私は以下のように使用します:
HttpClient httpClient = new DefaultHttpClient();
HttpContext httpContext = new BasicHttpContext();
HttpPost postRequest = new HttpPost(url);
postRequest.addHeader("User-Agent", String.format("%s %s %s %s %s", Build.MANUFACTURER, Build.MODEL, Build.PRODUCT, Build.CPU_ABI, Config.appStr));
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart("sessionId", new StringBody(sessionId));
ByteArrayBody bab = new ByteArrayBody(afp, "afp");
reqEntity.addPart("afp", bab);
if (pcm != null)
{
ByteArrayBody bab2 = new ByteArrayBody(pcm, "pcm");
reqEntity.addPart("pcm", bab2);
}
postRequest.setEntity(reqEntity);
HttpResponse response = httpClient.execute(postRequest, httpContext);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
String sResponse;
StringBuilder s = new StringBuilder();
while ((sResponse = reader.readLine()) != null) {
s = s.append(sResponse);
System.out.println(sResponse);
}
GBAサービスの意味は何ですか?そして、どうすればGBAの許可を得ることができますか?メッセージを受け取った後、このリクエストを送信するスレッドは、例外を受け取って停止しているように見えます。GalaxyNotesでコードを実行しました。