{"id":6803,"date":"2014-04-23T08:07:16","date_gmt":"2014-04-23T08:07:16","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/fatal-exception-cordova-facebook-connectplugin-collection-of-common-programming-errors\/"},"modified":"2014-04-23T08:07:16","modified_gmt":"2014-04-23T08:07:16","slug":"fatal-exception-cordova-facebook-connectplugin-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/fatal-exception-cordova-facebook-connectplugin-collection-of-common-programming-errors\/","title":{"rendered":"FATAL EXCEPTION &#8211; cordova.facebook.ConnectPlugin-Collection of common programming errors"},"content":{"rendered":"<p>In <code>ConnectPlugin.java<\/code>, replace:<\/p>\n<pre><code>try {\n    JSONObject o = new JSONObject(this.fba.facebook.request(\"\/me\"));\n    this.fba.userId = o.getString(\"id\");\n    this.fba.success(getResponse(), this.fba.callbackId);\n} catch (MalformedURLException e) {\n    \/\/ TODO Auto-generated catch block\n    e.printStackTrace();\n} catch (IOException e) {\n    \/\/ TODO Auto-generated catch block\n    e.printStackTrace();\n} catch (JSONException e) {\n    \/\/ TODO Auto-generated catch block\n    e.printStackTrace();\n}\n<\/code><\/pre>\n<p>with the following code:<\/p>\n<pre><code>Thread t = new Thread(new Runnable() {\n    public void run() {\n        try {\n            JSONObject o = new JSONObject(fba.facebook.request(\"\/me\"));\n            fba.userId = o.getString(\"id\");\n            fba.success(getResponse(), fba.callbackId);\n        } catch (MalformedURLException e) {\n            \/\/ TODO Auto-generated catch block\n            e.printStackTrace();\n        } catch (IOException e) {\n            \/\/ TODO Auto-generated catch block\n            e.printStackTrace();\n        } catch (JSONException e) {\n            \/\/ TODO Auto-generated catch block\n            e.printStackTrace();\n        }\n    }\n});\nt.start();\n<\/code><\/pre>\n<p>Ref : NetworkOnMainThreadException on Facebook Login with Phonegap 1.6.0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In ConnectPlugin.java, replace: try { JSONObject o = new JSONObject(this.fba.facebook.request(&#8220;\/me&#8221;)); this.fba.userId = o.getString(&#8220;id&#8221;); this.fba.success(getResponse(), this.fba.callbackId); } catch (MalformedURLException e) { \/\/ TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { \/\/ TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { \/\/ TODO Auto-generated catch block e.printStackTrace(); } with the following code: Thread t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6803","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6803"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6803\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}