Android 应用 facebook https 网址未加载

标签 android facebook ssl https android-2.2-froyo

尝试开发一个集成社交网络的 android 应用程序,我正在测试的第一个是 Facebook。在执行授权功能时,我使用 WebView 而不是调用 native 应用程序(尽管我让它也尝试使用 native 应用程序并获得相同的结果)。执行授权功能时,它会显示“正在加载”对话框,但过了一会儿它就会死掉并返回到我的 Activity。

在模拟器中工作时,一切正常,登录/允许/拒绝屏幕出现,当我尝试在实际设备上使用它时,所有 https url 都不会加载(示例:https://graph.facebook.com/19292868552 https://m.facebook.com/dialog/等)。

奇怪的是,当尝试在 Android 设备上的任何浏览器中放置应用程序尝试使用的相同 facebook https 链接时,它们也不会加载到那里,我得到一个“网页不可用”。所有其他 https 链接都可以正常工作 gmail、paypal、greendotcard 等。在我的 PC 上的浏览​​器中尝试相同的 https 链接时,尽管页面加载正常。

设备:

  1. 安卓 2.2.2 (LG-P505)
  2. 使用 WIFI 连接(是的,连接是 工作)

我在另一台设备(完全相同的型号和 android 版本)上尝试过此操作并获得相同的结果。但是,如果我将我的设备切换为使用 Android 4.0.3(clockworkmod/rom 管理器等),该应用程序会像它应该的那样工作(facebook https 链接工作正常)

我看到其他人也有类似的问题,所以我尝试了以下方法:

  1. 重启手机
  2. 已检查互联网连接
  3. 在 WebViewClient 中设置 onReceiveSslError:
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) 
{
  Log.d("Facebook connection","SSL ERROR");
  handler.proceed() ;
}

执行facebook授权函数的代码:

    facebook.authorize(this, new String[] { "read_stream", "publish_stream" }, new DialogListener() {
        public void onComplete(Bundle values) 
        {
            Log.d("Facebook onComplete",""+values);
        }

        public void onFacebookError(FacebookError error) {
            Log.d("Facebook onFacebookError",error.getMessage());
        }

        public void onError(DialogError e) 
        {
            Log.d("Facebook onError",e.getMessage());
        }

        public void onCancel() 
        {
            Log.d("Facebook onCancel","It canceled?");
        }
    });       

LogCat:

06-06 10:43:48.991: V/webkit(22468): BrowserFrame constructor: this=Handler{44be3ba0}
06-06 10:43:49.001: V/webcore(22468): LOAD_URL arg1=0 arg2=0 obj=android.webkit.WebViewCore$GetUrlData@44be55c8
06-06 10:43:49.011: V/webcore(22468):  CORE loadUrl https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:43:49.011: V/webkit(22468): startLoadingResource: url=https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess, method=GET, postData=null, isMainFramePage=true, mainResource=true, userGesture=true
06-06 10:43:49.021: V/webkit(22468): LoadListener constructor url=https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:43:49.021: D/KeyguardViewMediator(1384): setHidden false
06-06 10:43:49.031: V/http(22468): 44550853 http0 RequestQueue.getRequest() => null
06-06 10:43:49.031: V/http(22468): 44550854 http0 ConnectionThread: Waiting for work
06-06 10:43:49.031: V/webview(22468): sendOurVisibleRect=(14,39,r=306,b=466
06-06 10:43:49.031: V/http(22468): 44550856 http1 RequestQueue.getRequest() => null
06-06 10:43:49.031: V/http(22468): 44550856 http1 ConnectionThread: Waiting for work
06-06 10:43:49.041: V/http(22468): 44550866 http2 RequestQueue.getRequest() => null
06-06 10:43:49.041: V/http(22468): 44550866 http2 ConnectionThread: Waiting for work
06-06 10:43:49.041: V/http(22468): 44550867 http3 RequestQueue.getRequest() => null
06-06 10:43:49.041: V/http(22468): 44550867 http3 ConnectionThread: Waiting for work
06-06 10:43:49.051: D/KeyguardViewMediator(1384): setHidden false
06-06 10:43:49.051: V/webview(22468): WEBCORE_INITIALIZED_MSG_ID
06-06 10:43:49.051: V/webcore(22468): SET_SCROLL_OFFSET arg1=0 arg2=0 obj=Point(0, 0)
06-06 10:43:49.051: V/webcore(22468): SET_GLOBAL_BOUNDS arg1=0 arg2=0 obj=Rect(14, 39 - 306, 466)
06-06 10:43:49.051: V/webcore(22468): VIEW_SIZE_CHANGED arg1=0 arg2=0 obj=android.webkit.WebView$ViewSizeData@44bf1b88
06-06 10:43:49.051: V/webcore(22468): viewSizeChanged w=292; h=427; textwrapWidth=292; scale=1.0
06-06 10:43:49.051: V/webcore(22468): viewSizeChanged
06-06 10:43:49.051: V/webcore(22468): UPDATE_CACHE_AND_TEXT_ENTRY arg1=0 arg2=0 obj=null
06-06 10:43:49.061: V/webview(22468): setCertificate=null
06-06 10:43:49.081: W/Flex(22468): getString FLEX_OPERATOR_CODE ATT
06-06 10:43:49.081: W/Flex(22468): getString FLEX_MCC_CODE 310
06-06 10:43:49.081: W/Flex(22468): getString FLEX_OPERATOR_CODE ATT
06-06 10:43:49.081: W/Flex(22468): getString FLEX_MNC_CODE 410
06-06 10:43:49.081: W/Flex(22468): getString FLEX_OPERATOR_CODE ATT
06-06 10:43:49.091: W/Flex(22468): getString FLEX_OPERATOR_CODE ATT
06-06 10:43:49.091: W/Flex(22468): getString FLEX_OPERATOR_CODE ATT
06-06 10:43:49.131: V/webkit(22468): [web] x-wap-profile info is read from flex.
06-06 10:43:49.131: V/webkit(22468): [web] x-wap-profile added = http://gsm.lge.com/html/gsm/P505-M6-D1.xml
06-06 10:43:49.131: W/Flex(22468): getString FLEX_OPERATOR_CODE ATT
06-06 10:43:49.131: V/webkit(22468): [web] x-att-deviceid : LG-P505/V10i
06-06 10:43:49.141: V/webkit(22468): getCookie: uri: https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess value: datr=yLHOT47krLHRlqDkKtLSPq5-; m_ts=1338946325; reg_fb_gate=http%3A%2F%2Fm.facebook.com%2Flogin.php%3Fapp_id%3DCLIENTID%26cancel%3Dfbconnect%253A%252F%252Fsuccess%253Ferror_reason%253Duser_denied%2526error%253Daccess_denied%2526error_description%253DThe%252Buser%252Bdenied%252Byour%252Brequest.%26fbconnect%3D1%26next%3Dhttp%253A%252F%252Fm.facebook.com%252Fdialog%252Fpermissions.request%253F_path%253Dpermissions.request%2526app_id%253DCLIENTID%2526redirect_uri%253Dfbconnect%25253A%25252F%25252Fsuccess%2526display%253Dtouch%2526type%253Duser_agent%2526perms%253Dread_stream%25252Cpublish_stream%2526fbconnect%253D1%2526from_login%253D1%2526client_id%253DCLIENTID%26rcount%3D1; reg_fb_ref=http%3A%2F%2Fm.facebook.com%2Flogin.php%3Fapp_id%3DCLIENTID%26cancel%3Dfbconnect%253A%252F%252Fsuccess%253Ferror_reason%253Duser_denied%2526error%253Daccess_denied%2526error_description%253DThe%252Buser%252Bdenied%252Byour%252Brequest.%26fbconnect%3D1%26next%3Dhttp%253A%252F%252Fm.facebook.com%252Fdialog%252Fpermissions.request%253F_path%253Dpermissions.request%2526app_id%253DCLIENTID%2526redirect_uri%253Dfbconnect%25253A%25252F%25252Fsuccess%2526display%253Dtouch%2526type%253Duser_agent%2526perms%253Dread_stream%25252Cpublish_stream%2526fbconnect%253D1%2526from_login%253D1%2526client_id%253DCLIENTID%26rcount%3D1
06-06 10:43:49.141: V/webkit(22468): FrameLoader: http GET load for: https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:43:49.151: V/http(22468): 44550972 WebViewWorkerThread RequestQueue.queueRequest https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:43:49.151: V/http(22468): 44550974 http0 RequestQueue.getRequest() => /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:43:49.151: V/http(22468): 44550974 http0 ConnectionThread: new request https://m.facebook.com:443 /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:43:49.151: V/http(22468): 44550975 http0 SEND pipe 0
06-06 10:43:49.161: V/webkit(22468): LoadListener.attachRequestHandle(): requestHandle: android.net.http.RequestHandle@44c0eef8
06-06 10:43:49.201: V/webview(22468): SET_SCROLLBAR_MODES
06-06 10:43:49.201: V/webview(22468): SET_SCROLLBAR_MODES
06-06 10:43:49.201: V/webview(22468): SET_SCROLLBAR_MODES
06-06 10:43:49.201: V/webview(22468): UPDATE_TEXT_ENTRY_MSG_ID
06-06 10:43:49.261: V/webcore(22468): SET_ACTIVE arg1=0 arg2=0 obj=null
06-06 10:43:50.391: D/DfeApi(17382): [1] DfeRequest.deliverResponse: Not delivering second response for request=[[ ] https://android.clients.google.com/fdfe/details?doc=sui.m NORMAL 415]
06-06 10:43:50.391: D/Volley(17382): [1] Request.finish: 5076 ms: [ ] https://android.clients.google.com/fdfe/details?doc=sui.m NORMAL 415
06-06 10:44:00.061: I/hs(21761): android.intent.action.TIME_TICK
06-06 10:44:02.841: D/Finsky(17382): [1] 5.onFinished: Installation state replication succeeded.
06-06 10:44:10.491: V/http(22468): 44572311 http0 Connection.openHttpConnection() 21336 https://m.facebook.com:443
06-06 10:44:10.491: V/http(22468): 44572312 http0 RequestQueue.getRequest() => /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:44:10.491: V/http(22468): 44572313 http0 ConnectionThread: new request https://m.facebook.com:443 /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:44:10.491: V/http(22468): 44572314 http0 SEND pipe 0
06-06 10:44:31.501: V/http(22468): 44593321 http0 Connection.openHttpConnection() 21006 https://m.facebook.com:443
06-06 10:44:31.501: V/http(22468): 44593321 http0 RequestQueue.getRequest() => /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:44:31.501: V/http(22468): 44593322 http0 ConnectionThread: new request https://m.facebook.com:443 /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:44:31.501: V/http(22468): 44593323 http0 SEND pipe 0
06-06 10:44:52.511: V/http(22468): 44614331 http0 Connection.openHttpConnection() 21006 https://m.facebook.com:443
06-06 10:44:52.511: V/http(22468): 44614332 http0 httpFailure() ******* java.io.IOException: The operation timed out count 2 https://m.facebook.com:443 /dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess
06-06 10:44:52.511: V/webkit(22468): LoadListener.error url:https://m.facebook.com/dialog/oauth?display=touch&client_id=CLIENTID&scope=read_stream%2Cpublish_stream&type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess id:-6 description:The connection to the server was unsuccessful.
06-06 10:44:52.511: V/webkit(22468): LoadListener.detachRequestHandle(): requestHandle: android.net.http.RequestHandle@44c0eef8
06-06 10:44:52.521: V/http(22468): 44614343 http0 RequestQueue.getRequest() => null
06-06 10:44:52.521: D/Facebook onError(22468): The connection to the server was unsuccessful.
06-06 10:44:52.521: V/http(22468): 44614345 http0 ConnectionThread: Waiting for work
06-06 10:44:52.521: V/webview(22468): setCertificate=null
06-06 10:44:52.551: I/ActivityManager(1384): Displayed activity com.fadedfootsteps/.FadedFootstepsActivity: 64220 ms (total 64220 ms)
06-06 10:44:52.591: V/webkit(22468): startLoadingResource: url=file:///android_asset/webkit/android-weberror.png, method=GET, postData=null, isMainFramePage=true, mainResource=false, userGesture=true
06-06 10:44:52.591: V/webkit(22468): LoadListener constructor url=file:///android_asset/webkit/android-weberror.png
06-06 10:44:52.601: V/webkit(22468): LoadListener: from: file:///android_asset/webkit/android-weberror.png major: 1 minor: 1 code: 200 reason: OK
06-06 10:44:52.601: V/webkit(22468): LoadListener.headers
06-06 10:44:52.601: V/webkit(22468): LoadListener.data(): url: file:///android_asset/webkit/android-weberror.png
06-06 10:44:52.601: V/webkit(22468): LoadListener.endData(): url: file:///android_asset/webkit/android-weberror.png
06-06 10:44:52.601: V/webkit(22468): guessMimeTypeFromExtension: url = file:///android_asset/webkit/android-weberror.png
06-06 10:44:52.631: V/webkit(22468): LoadListener.detachRequestHandle(): requestHandle: null
06-06 10:44:52.631: V/webview(22468): SET_SCROLLBAR_MODES
06-06 10:44:52.631: V/webview(22468): SET_SCROLLBAR_MODES
06-06 10:44:52.631: V/webview(22468): SET_SCROLLBAR_MODES
06-06 10:44:52.641: V/webcore(22468): didFirstLayout standardLoad =true
06-06 10:44:52.641: V/webcore(22468): WEBKIT_DRAW arg1=0 arg2=0 obj=null
06-06 10:44:52.651: V/webcore(22468): webkitDraw start
06-06 10:44:52.651: V/webview(22468): UPDATE_TEXT_ENTRY_MSG_ID
06-06 10:44:52.681: V/webcore(22468): webkitDraw NEW_PICTURE_MSG_ID
06-06 10:44:52.691: V/webview(22468): NEW_PICTURE_MSG_ID
06-06 10:44:52.701: V/webview(22468): NEW_PICTURE_MSG_ID {0,0,1063,427}

最佳答案

解决了问题。这是由于我如何设置 wifi 网络。有互联网连接共享,将我的移动宽带(USB 设备)共享到我的 wifi 路由器,并将路由器设置为接入点。将其改回正常使用状态,并将 Android 设备放入 DMZ,确保没有任何东西会阻止其网络调用。

通常会事先检查这一点,但所有其他安全网站都运行良好,所以直到后来才想到。

关于Android 应用 facebook https 网址未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10917608/

相关文章:

node.js - https.createServer 错误 : SSL_CTX_use_certificate: ca md too weak

Play 框架中通过 SSL 的 MongoDB 连接

android - 如何加载数据以使其在 ActivityList 中可见?

android - 如何在json数据中添加索引?

java - 使用Gson检索数据

css - 从 Facebook 社交插件中删除 css 表达式

javascript - 关于 Facebook Timer 的一些困扰我的事情

java - 为什么我的 Spring OAuth2 服务器无法使用 SSL 自签名 ssl?

android - 如何使用 MyLocationOverlay 在 MapView 上绘制当前 GPS 位置?

java - (#200) 需要扩展权限 : publish_actions