Android app facebook https网址没有加载

时间:2012-06-06 15:45:25

标签: android facebook ssl https android-2.2-froyo

尝试开发一个集成社交网络的Android应用程序,我测试的第一个是Facebook。在执行授权功能时,我使用WebView而不是调用本机应用程序(虽然我已经让它尝试使用本机应用程序并获得相同的结果)。执行authorize函数时,它显示“加载”对话框,但过了一段时间它就会死掉并返回到我的Activity。

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

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

设备:

  1. Android 2.2.2(LG-P505)
  2. 使用WIFI连接(是连接是 工作)
  3. 我在另一台设备(完全相同的型号和Android版本)上试过这个并得到相同的结果。但是,如果我将我的设备切换为使用Android 4.0.3(clockworkmod / rom manager等),该应用程序的工作方式应该如此(facebook https链接工作正常)

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

    1. 重新启动手机
    2. 已检查互联网连接
    3. 在WebViewClient中设置onReceiveSslError:
    4. 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}
      

1 个答案:

答案 0 :(得分:0)

找出问题所在。这是由于我如何设置我的wifi网络。有互联网连接共享,共享我的移动宽带(USB设备)到我的wifi路由器,并将路由器设置为接入点。将其更改回正常使用并将Android设备放入DMZ,确保没有任何内容阻止其网络呼叫。

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