{"action":"created","issue":{"url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/27","labels_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/27/comments","events_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/27/events","html_url":"https://github.com/pwittchen/ReactiveNetwork/issues/27","id":109545120,"number":27,"title":"Mobile data loss and 100% loss","user":{"login":"josias1991","id":6580298,"avatar_url":"https://avatars.githubusercontent.com/u/6580298?v=3","gravatar_id":"","url":"https://api.github.com/users/josias1991","html_url":"https://github.com/josias1991","followers_url":"https://api.github.com/users/josias1991/followers","following_url":"https://api.github.com/users/josias1991/following{/other_user}","gists_url":"https://api.github.com/users/josias1991/gists{/gist_id}","starred_url":"https://api.github.com/users/josias1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josias1991/subscriptions","organizations_url":"https://api.github.com/users/josias1991/orgs","repos_url":"https://api.github.com/users/josias1991/repos","events_url":"https://api.github.com/users/josias1991/events{/privacy}","received_events_url":"https://api.github.com/users/josias1991/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-02T18:22:31Z","updated_at":"2015-10-03T14:59:24Z","closed_at":null,"body":"Hey man, first off. Thanks for all your hard work. The library is amazing. \r\n\r\nI was using your library and i noticed there is something missing. We cannot check mobile data loss nor can we check 100% loss.\r\n\r\nYes, the library detects if there is no internet (airplane mode) or if we do have internet (Wifi connected, internet available and mobile connected) but it would be nice if the following scenarios could be handled as well:\r\n\r\nMobile data loss: eg user is underground and mobile data is loss. Initially i thought that unknown would be used to handle this but it isnt. I had to do it separately.\r\n\r\nHere is a code snippet on how i am currently doing it without the library:\r\n\r\n    /**\r\n     * Determines if there is or if there isnt actual mobile data\r\n     *\r\n     * @return\r\n     */\r\n    private boolean hasMobileData() {\r\n        boolean mobileDataEnabled = true; // Assume disabled\r\n        ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);\r\n        try {\r\n            Class cmClass = Class.forName(cm.getClass().getName());\r\n            Method method = cmClass.getDeclaredMethod(\"getMobileDataEnabled\");\r\n            method.setAccessible(true); // Make the method callable\r\n\r\n            // get the setting for \"mobile data\"\r\n            mobileDataEnabled = (Boolean) method.invoke(cm);\r\n        } catch (ClassNotFoundException e) {\r\n            e.printStackTrace();\r\n        } catch (NoSuchMethodException e) {\r\n            e.printStackTrace();\r\n        } catch (InvocationTargetException e) {\r\n            e.printStackTrace();\r\n        } catch (IllegalAccessException e) {\r\n            e.printStackTrace();\r\n        }\r\n\r\n        Log.e(TAG, \"hasMobileData: \" + mobileDataEnabled);\r\n        return mobileDataEnabled;\r\n    }\r\n\r\nAlso, the other scenario is when we do not have mobile data but we DO have Wifi and it is on 100% packet loss (can be tested using a Network Link Conditioner). This basically means internet is there, we are connected to Wifi but packets are just not coming in.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/comments/145254678","html_url":"https://github.com/pwittchen/ReactiveNetwork/issues/27#issuecomment-145254678","issue_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/27","id":145254678,"user":{"login":"josias1991","id":6580298,"avatar_url":"https://avatars.githubusercontent.com/u/6580298?v=3","gravatar_id":"","url":"https://api.github.com/users/josias1991","html_url":"https://github.com/josias1991","followers_url":"https://api.github.com/users/josias1991/followers","following_url":"https://api.github.com/users/josias1991/following{/other_user}","gists_url":"https://api.github.com/users/josias1991/gists{/gist_id}","starred_url":"https://api.github.com/users/josias1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josias1991/subscriptions","organizations_url":"https://api.github.com/users/josias1991/orgs","repos_url":"https://api.github.com/users/josias1991/repos","events_url":"https://api.github.com/users/josias1991/events{/privacy}","received_events_url":"https://api.github.com/users/josias1991/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T14:59:24Z","updated_at":"2015-10-03T14:59:24Z","body":"Thanks for the quick response! \r\n\r\nSounds good man, just thought it would be worth mentioning it.\r\n\r\nThanks anyways, ill keep on looking into it a bit more and finding the best way to do this in combination with your library.\r\n\r\n"}}