Scenario #1 1. User opens the app 2. Device is connected to the network 3. App downloads data from server 4. User can read data Senario #2 1. User opens the app 2. Device is not connected to the network 3. App tries to download data from server 4. ... 5. Connection timeout 6. Nothing happens or app crashes 7. User is not happy :-( Happy path :-D Unhappy path ;-(
2. Device is disconnected from the network 3. Connectivity check fails 4. Device gets connected to the network 5. User cannot access the network with the app 6. User is unhappy :-( Unhappy path ;-( How to fix this situation?
support is disabled by default. We need to apply additional network security configuration in such cases. • https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted • https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted/50834 600#50834600
different connection types Network Callback from Lollipop Checking Internet connectivity for Walled Garden Doze mode Checking Internet connectivity with Socket Frequency of checking Internet connectivity Handling connectivity check asynchronously ClearText traffic
and maintenance • 10 developers contributed to the code-base • 41 releases so far • More than 80% of code covered by unit tests • Documentation, JavaDocs and exemplary apps • Works with RxJava1.x and RxJava2.x (on separate artifacts and git branches) • Up to date with the latest RxJava version (which is used as a dependency) • Works with Java and Kotlin • It’s free and open-source: https://github.com/pwittchen/ReactiveNetwork • Backed by Travis Continuous Integration Server • Verified by static code analysis tools (CheckStyle, PMD, FindBugs, Lint, NullAway) • Tested in production • Available on the Maven Central Repository (easy to use with Gradle)
type from RxJava2 depending on our use case We can customize: • host • port • timeout in ms • initial observing interval in ms • ping interval in ms • strategy https://github.com/pwittchen/ReactiveNetwork#observing-internet-connectivity
Internet connectivity • Apps can work off-line • Apps can be disconnected from the network anytime • WiFi network can be disconnected from the Internet anytime • Battery of the device should not be drained • Mobile data transfer should be used carefully • We should provide the best User Experience possible • Do not reinvent the wheel - we have libraries :-)