Comments (8)
I will try to add this as soon as possible.
Thanks
Amit Shekhar
from fast-android-networking.
@willemevenwel : added in development branch
from fast-android-networking.
Thanks, great work. Tested and working. Will provide more feedback if more feedback comes up.
from fast-android-networking.
Hi, Thanks for this awesome library. I have one question. How to get the status code from the response.? I didn't find any way to get that.
from fast-android-networking.
@nithingkamath : You are welcome.
to get the response code you can call response.code() if you are using getAsOkHttpResponse.
And also like this :
We have a callback method onError(ANError error).
if (error.getErrorCode() != 0) {
// received error from server
// error.getErrorCode() - the error code from server
// error.getErrorBody() - the error body from server
// error.getErrorDetail() - just an error detail
Log.d(TAG, "onError errorCode : " + error.getErrorCode());
Log.d(TAG, "onError errorBody : " + error.getErrorBody());
Log.d(TAG, "onError errorDetail : " + error.getErrorDetail());
} else {
// error.getErrorDetail() : connectionError, parseError, requestCancelledError
Log.d(TAG, "onError errorDetail : " + error.getErrorDetail());
}
from fast-android-networking.
@amitshekhariitbhu
Could you please provide support that OkHttpResponse
object will get passed in onResponse
method of ParsedRequestListener
interface?
In that case, we can get the status code from OkHttpResponse
object and still enjoying the parsed object in onResponse
. Thanks in advance!
from fast-android-networking.
As of I have done to get OkHttpResponse in Development as getAsOkHttpResponse
As of now I have uploaded it on beta.
So please compile using the below link.
compile 'com.amitshekhar.android:android-networking:0.2.0-beta-0
.getAsOkHttpResponse(new OkHttpResponseListener() {
@Override
public void onResponse(Response response) {
if (response != null) {
// we can find header also like response.headers() or anything than can be obtained from OkHttpResponse
if (response.isSuccessful()) {
Log.d(TAG, "response is successful");
try {
Log.d(TAG, "response : " + response.body().source().readUtf8());
} catch (IOException e) {
e.printStackTrace();
}
} else {
Log.d(TAG, "response is not successful");
}
} else {
Log.d(TAG, "response is null");
}
}
@Override
public void onError(ANError error) {
Utils.logError(TAG, error);
}
});
I think you are telling to provide both parseResponse and OkHttpResponse in a response listener
from fast-android-networking.
Thank you for your quick reply!
I am aware of the OkHttpResponseListener
functionality. What I requested, can be summarized like below,
.getAsParsed(new TypeToken<User>() {}, new ParsedRequestListener<User>() {
@Override
public void onResponse(Response response, User user) {
// we can find header like response.headers()
// we can get user as parsed
}
@Override
public void onError(ANError anError) {
// handle error
}
});
from fast-android-networking.
Related Issues (20)
- Unable to use in new Android Project HOT 1
- Could not find package library
- AndroidNetworking.initialize(getApplicationContext()); Not working HOT 14
- Could not find com.amitshekhar.android:android-networking:1.0.2. HOT 5
- https://github.com/MindorksOpenSource/android-mvp-architecture
- Seri
- Lib is missing? Can't fetch v1.0.2 with gradle. See screenshot. HOT 1
- Failed to resolve: HOT 11
- Error building project HOT 4
- Networking
- ANRequest unregister `requestListener` HOT 1
- Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'. HOT 8
- How can I get the Body Parameters sent with request.
- i cannot import AndroidNetworking Class HOT 2
- AndroidNetworking class is not being imported HOT 4
- Can we get an Androidx Update to this?
- Repository down?
- I'm getting this error Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
- Regarding Fast Android Networking latest features support and new update HOT 2
- Failed to resolve HOT 2
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 fast-android-networking.