Description
API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service) in Android.
API Calling Flow alternatives and similar packages
Based on the "Utility" category.
Alternatively, view API Calling Flow alternatives based on common mentions on social networks and blogs.
-
timber
A logger with a small, extensible API which provides utility on top of Android's normal Log class. -
ExpirableDiskLruCache
DISCONTINUED. Java implementation of a Disk-based LRU cache which specifically targets Android compatibility. -
Android-Templates-And-Utilities
Collection of source codes, utilities, templates and snippets for Android development. -
secure-preferences
DISCONTINUED. Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure. -
greenrobot-common
General purpose utilities and hash functions for Android and Java (aka java-common) -
Androl4b
A Virtual Machine For Assessing Android applications, Reverse Engineering and Malware Analysis -
vector-compat
A support library for VectorDrawable and AnimatedVectorDrawable classes introduced in Lollipop -
CastCompanionLibrary-android
DISCONTINUED. CastCompanionLibrary-android is a library project to enable developers integrate Cast capabilities into their applications faster and easier. -
motion
An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt -
Colours
A beautiful set of predefined colors and a set of color methods to make your Android development life easier. -
Reservoir
DISCONTINUED. Android library to easily serialize and cache your objects to disk using key/value pairs.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of API Calling Flow or a related project?
README
-->
API Calling Flow
API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service) in Android.
Download example App here or checkout example.
Features
- Internal Network State Checking.
- On screen Setting's shortcuts to enable Wi-FI or Mobile Data.
- Hide unloaded screen during API call and show progress bar with white or transparent background.
- "Try Again" same API after enabling Network connection.
- Call API only if the Network connection is enabled.
- Remove progress bar after successfully loading data on screen.
- Show full-screen errors to users and hide unloaded screen from user for better user experience.
Setup
In your Project's build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
...
}
}
In your Application's or Module's build.gradle file:
dependencies {
...
compile 'com.github.RohitSurwase.API-Calling-Flow:api-calling-flow:1.1'
...
}
Screenshots
Case 1. when Network connection is not available-
Network Connection is not available | Setting's shortcut to enable Network Connection |
Case 2. When Network connection is available and API is successful-
Network Connection is available | API requested | API successful, data loaded |
Case 3. When Network connection is available but API is failed-
Network Connection is available | API requested | API failed, error shown |
Code Example
Refer to the example for complete implementation and usage.
- Step 1: Get reference to root layout of Activity or Fragment. Root layout can be any ViewGroup
Example-
RelativeLayout parentLayout = (RelativeLayout) findViewById(R.id.rootLayout);
- Step 2: Crete Object of ApiCallingFlow and implement methods.
- 1st parameter - context
- 2nd parameter - parentLayout from step 1
- 3rd parameter - true for transparent background, false for default white background
Step 3: Pass function to call current API on click of try again.
private void requestTestApi() { ... ApiCallingFlow apiCallingFlow = new ApiCallingFlow(this, parentLayout, false) { @Override public void callCurrentApiHere() { //Step 3: Pass function to call current API requestTestApi(); } }; ... }
Step 4: Get current Network state using apiCallingFlow.getNetworkState() and request API accordingly.
Step 5: Call apiCallingFlow.onSuccessResponse() in API success function.
Step 6: Call apiCallingFlow.onErrorResponse() in API error function.
Customizations
Change progressbar color according to your app theme. By default progrebar has R.color.colorAccent color But if you want to customize it, you can do it by passing additional parameter to the function.
...
ApiCallingFlow apiCallingFlow = new ApiCallingFlow(this, parentLayout, false, R.color.progressBarColor) {
...
License
Copyright 2017-18 Rohit Surwase
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Contributing to API Calling Flow Library
Just make pull request. You are in!
*Note that all licence references and agreements mentioned in the API Calling Flow README section above
are relevant to that project's source code only.