{"action":"created","issue":{"url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy/issues/10","repository_url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy","labels_url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy/issues/10/comments","events_url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy/issues/10/events","html_url":"https://github.com/dpa99c/cordova-plugin-request-location-accuracy/issues/10","id":165068320,"number":10,"title":"Fails to handle error correctly if Google Play outdated","user":{"login":"grassick","id":1238335,"avatar_url":"https://avatars.githubusercontent.com/u/1238335?v=3","gravatar_id":"","url":"https://api.github.com/users/grassick","html_url":"https://github.com/grassick","followers_url":"https://api.github.com/users/grassick/followers","following_url":"https://api.github.com/users/grassick/following{/other_user}","gists_url":"https://api.github.com/users/grassick/gists{/gist_id}","starred_url":"https://api.github.com/users/grassick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grassick/subscriptions","organizations_url":"https://api.github.com/users/grassick/orgs","repos_url":"https://api.github.com/users/grassick/repos","events_url":"https://api.github.com/users/grassick/events{/privacy}","received_events_url":"https://api.github.com/users/grassick/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-12T12:30:35Z","updated_at":"2016-07-13T14:40:46Z","closed_at":"2016-07-12T14:47:00Z","body":"If Google Play Services is outdated, it crashes as follows:\r\n\r\n```\r\njava.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.error(org.json.JSONObject)' on a null object reference\r\ntat cordova.plugin.RequestLocationAccuracy.handleError(RequestLocationAccuracy.java:216)\r\nat cordova.plugin.RequestLocationAccuracy.onConnectionFailed(RequestLocationAccuracy.java:442)\r\n```\r\n\r\nSince context isn't set.\r\n\r\nI notice that it will fail in the same way if it gets an exception making the request:\r\n\r\n```\r\n        }catch(Exception e ) {\r\n            handleError(e.getMessage(), ERROR_EXCEPTION);\r\n            result = false;\r\n        }\r\n```\r\n\r\nBecause it has not done a: `context = callbackContext;`\r\n\r\nI'm getting tons of these crashes from our users, unfortunately. I suspect there is a lot of outdated Google Play Services out there.\r\n"},"comment":{"url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy/issues/comments/232376466","html_url":"https://github.com/dpa99c/cordova-plugin-request-location-accuracy/issues/10#issuecomment-232376466","issue_url":"https://api.github.com/repos/dpa99c/cordova-plugin-request-location-accuracy/issues/10","id":232376466,"user":{"login":"grassick","id":1238335,"avatar_url":"https://avatars.githubusercontent.com/u/1238335?v=3","gravatar_id":"","url":"https://api.github.com/users/grassick","html_url":"https://github.com/grassick","followers_url":"https://api.github.com/users/grassick/followers","following_url":"https://api.github.com/users/grassick/following{/other_user}","gists_url":"https://api.github.com/users/grassick/gists{/gist_id}","starred_url":"https://api.github.com/users/grassick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grassick/subscriptions","organizations_url":"https://api.github.com/users/grassick/orgs","repos_url":"https://api.github.com/users/grassick/repos","events_url":"https://api.github.com/users/grassick/events{/privacy}","received_events_url":"https://api.github.com/users/grassick/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T14:40:46Z","updated_at":"2016-07-13T14:40:46Z","body":"I'm worried that this won't solve it: `initialize` calls `buildGoogleApiClient` before a request is made, and thus before a context is available. If it can't connect, might `.addOnConnectionFailedListener(this)` be triggered immediately? In which case `context.error(error)` would still crash? Maybe there should be a check for null around the context.error part."}}
{"actor":{"display_login":"grassick"}}