-1

试图开发一个集成社交网络的安卓应用程序,我正在测试的第一个是 Facebook。在执行授权功能时,我使用 WebView 而不是调用本机应用程序(尽管我也让它尝试使用本机应用程序并获得相同的结果)。执行授权功能时,它会显示“正在加载”对话框,但过了一会儿它就会死掉并返回到我的 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?");
        }
    });       

日志猫:

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}
4

1 回答 1

0

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

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

于 2012-06-06T23:40:42.080 回答