My application constantly does API requests and I am checking connection status with ConnectivityManager
. If it's connected then requesting for a data from the server, if not showing an error dialog that says Not connected to internet.
Well above method is manageable, but I wanted to have much more cleaner method for checking connectivity status and was thinking of Annotation Processing Library. Something like if I put @RequiresConnection
annotation on my method that requests connection, then if it's not connected then it will automatically fire an error dialog with a retry button invoking the function that didn't get executed. So whenever user pressed a Retry
button of dialog, it again tries to execute that function?
I am thinking of doing this annotation processing myself, but if it's already out there with I wanted to use it. Is there any such library?