-1

Trying to develop an android app that integrates social networking, and the first one i am testing out is Facebook. When doing the authorize function i have it using the WebView instead of calling up the native app (although i have let it try to use the native app as well and get the same results). When executing the authorize function it shows the "loading" dialog, but after awhile it just dies and goes back to my Activity.

When working in the emulator everything works fine the Login/ allow/deny screen shows up, its when i try to use it on an actual device that none of the https urls will load ( example: https://graph.facebook.com/19292868552 https://m.facebook.com/dialog/ etc ).

The weird thing is when trying to put the same facebook https links that the app tries to use in any browser on the android device, they dont load there either, i get a "Web page Unavailable". All other https links work fine gmail, paypal, greendotcard, etc. When trying the same https links in a browser on my PC though the pages load fine.

The device:

  1. Android 2.2.2 (LG-P505)
  2. Connected using WIFI ( yes the connection is working )

I have tried this on another device (exact same model and android version ) and get the same result. However if i switch my device to use Android 4.0.3 ( clockworkmod/rom manager etc ) the app works like it should (facebook https links work fine)

I seen others have similar problems so ive tried the following:

  1. Rebooting the phone
  2. Checked internet connection
  3. Setting the onReceiveSslError in the WebViewClient:
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) 
{
  Log.d("Facebook connection","SSL ERROR");
  handler.proceed() ;
}

Code executing the facebook authorize function:

    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}
Patrick Evans
  • 41,991
  • 6
  • 74
  • 87
  • What happens if you try using the facebook sdk for authentication on a device which does not have the facebook application (katana) installed? – Nitzan Tomer Jun 06 '12 at 18:48
  • Same results, i have installed and uninstalled the the facebook app and both times get the same results its unable to load any https urls – Patrick Evans Jun 06 '12 at 19:55
  • Have you tried to use other applications that require facebook authentication on the same device to check if it's a problem with your code or with the device/os? – Nitzan Tomer Jun 06 '12 at 20:00
  • As i mentioned in the problem i took the urls that the app was using and loaded them in the android browser/xScope/dolphin hd browsers and even they couldnt load the urls, but when trying them on a PC browser they work. Also as i mentioned the same thing happens on a completely different device that i tried this on, one that was exactly the same model and android version. – Patrick Evans Jun 06 '12 at 20:35
  • I understood all of that, but I asked if other applications on the same device run into the same issue or do they manage to authenticate? Also, maybe try to run a network sniffer on the device and on the pc and compare the requests, since you are using the same exact urls and the error is timeout, then maybe somehow the requests differ (headers, cookies or encoding) which in the device case perhaps confuses the fb servers. – Nitzan Tomer Jun 06 '12 at 20:51
  • ive tried the sample programs that come with the fb sdk ( hackboo, etc ) but they act the same way the loading dialog comes up and then dies and goes back to the executing Activity, giving the same error "connection to the server was unsuccessful", i installed a ping/dns/http headers tools app onto the device and tested a couple of the urls with it, like the graph.facebook.com one gives me a 200 ok, while the other ones give me a redirect (redirect to the login url) – Patrick Evans Jun 06 '12 at 21:18
  • 1
    let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/12219/discussion-between-nitzan-tomer-and-patrick-evans) – Nitzan Tomer Jun 06 '12 at 21:28

1 Answers1

0

Figured out the problem. It was due to how i had my wifi network setup. Had internet connection sharing, sharing my mobile broadband (usb device) to my wifi router, and the router was set as a access point. Changed it back over to normal use and put the android device into the DMZ making sure nothing would block its network calls.

Normally would have checked this before hand but all other secure websites were working fine so didnt think of it till later.

Patrick Evans
  • 41,991
  • 6
  • 74
  • 87