的Apache HTTP客户端NafHttpAuthStrategyDefault
当我在Android上使用的Apache HTTP客户端,我得到了logcat的可疑邮件。的Apache HTTP客户端NafHttpAuthStrategyDefault
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的许可? 获取消息后,发送此请求的线程看起来像获取异常并停止。 我在Galaxy Notes上执行了代码。
我相信你指的是GBA服务描述如下:http://en.wikipedia.org/wiki/Generic_Bootstrapping_Architecture
我有这样的消息出现在我的日志为好,但网络连接仍然成功地完成了我。
的一个时候,我有以下的,当时我试图让从主线程,我相信这是不允许的网络连接异常。
GBA - 通用引导架构(由3GPP标准定义的认证机制)... http://en.wikipedia.org/wiki/Generic_Bootstrapping_Architecture获取更多信息。
在Galaxy Note的(我认为是T-Mobile版),T-mobile的修改的Apache HTTP客户端,包括通过WiFi GBA客户端进行身份验证特别是对于通过WiFi MMS。
问题是为什么要使用GBA?通常使用ISIM密钥进行认证,运营商将其用于其服务。
如果你的应用程序是普通的应用程序,最好的办法是坚持与Android默认的HTTP客户端,并且不使用Apache的HTTP客户端。
您应更改为HttpURLConnection的,这是消耗HTTP服务的首选方式。您可以了解更多关于此:
http://android-developers.blogspot.com.br/2011/09/androids-http-clients.html
短版:忽略这些消息。
支持WiFi呼叫和其他一些功能的T-Mobile设备使用称为GBA的GSM移动标准通过T-Mobile对其服务进行身份验证。有问题的信息是日志声明,表示您的应用程序不被识别为T-Mobile应用程序,因此GBA不会在请求标头中被广告。如果您确实支持GBA,您将看到的唯一区别就是将“gba”包含在请求的用户代理标头中。
如果您的客户端与之通信的服务器应用程序支持GBA,则开发人员应该与T-Mobile建立关系,并告诉您如何在应用程序中启用GBA身份验证。
它在卸载应用程序并重新安装后修复!
我有类似的问题... – Joel 2012-08-13 18:17:28