Comments (5)
Also waiting for this!
from reactivenetwork.
Me too.
from reactivenetwork.
I remember about that. I just need to find some time for this. Recently, I've bumped library version and added new updates like support for Android N and better network monitoring, which are crucial enhancements in this project. Providing this example will be next on my list. :)
from reactivenetwork.
I'm currently using this library with Retrofit + RxJava using Observable#retryWhen()
using one of the older versions of ReactiveNetwork: https://github.com/rectangle-dbmi/Realtime-Port-Authority/blob/7.0.2/app/src/main/java/rectangledbmi/com/pittsburghrealtimetracker/BusMapFragment.java#L555
This will work when both of these two criteria are true:
- the restish server cannot be reached (the retrofit observable throws an IOException)
- when it is determined that this is due to a lost data connection on the phone side (though there is a bug where I'm not looking at SocketTimeoutException when I should... in other words, the app currently doesn't account for when the restish server is down and also thinks the phone connection is down... a bug)
I know that maybe people will be checking internet connection first then do their retrofit call, but I did my logic in reverse. My observable chain is currently running in an interval, and I wanted my interval to stop polling the restish server when the internet is gone, and restart the second when the internet is back. The lines of code above do exactly, that.
I hope that in the future, for the next rewritten feature of my app, I can a stack clicks for network calls when internet on the phone is somehow down and retry those click actions deriving from the logic above, too.
Currently, the rest of the code is a bit scary (because of my failure to use one of the MVVM patterns of Android... which will be fixed). I will be changing to the newer version of the library later AND will be using the internetConnectivityObservable when I have the time to change it.
from reactivenetwork.
I've added a simple example here: https://github.com/pwittchen/ReactiveNetwork#integration-with-retrofit.
It's valid for RxJava2.x version.
from reactivenetwork.
Related Issues (20)
- "NetworkCallback was already unregistered" if re-using Observable HOT 4
- Migrate CI from Travis to GitHub Actions
- connection speed HOT 5
- fix error prone config for the RxJava2.x branch after bumping its version HOT 1
- Release 4.0.0-rx3 HOT 11
- [Question] What is a reason to use http instead of https protocol in your library internal requests? HOT 1
- How know which connection type is better ? HOT 1
- NetworkInfo.State Deprecated HOT 1
- Rx Java 3 support
- BroadCast Receiver stopped working HOT 5
- Google pixel wifi change event is received in 30 sec delay HOT 5
- java.lang.IllegalArgumentException: Too many NetworkRequests filed in Android Nougat(7.1.1). HOT 7
- MarshmallowNetworkObservingStrategy.java line 80 HOT 4
- isConnectedToInternet always false
- Internet connectivity issue: Could not establish connection with WalledGardenStrategy HOT 1
- ReactiveNetwork(RN) usage of IPv6 and DNS results prioritization HOT 1
- Will there be a version for Kotlin Flow ? HOT 2
- Fix Robolectric tests HOT 1
- How to check Internet Connection in Background continuously even if App is Running or Not/Closed.. HOT 1
- Th
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactivenetwork.