Skip to content

Commit

Permalink
few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amitshekhariitbhu committed Sep 14, 2016
1 parent 1bee67d commit 7ff4905
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public ANResponse getAsParsed(TypeToken typeToken) {
return SynchronousCall.getResponse(this);
}

public ANResponse download() {
public ANResponse startDownload() {
return SynchronousCall.getResponse(this);
}

Expand Down
19 changes: 18 additions & 1 deletion app/src/main/java/com/networking/ApiTestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,24 @@ public void run() {
.setPriority(Priority.HIGH)
.setTag(this)
.build()
.download();
.setAnalyticsListener(new AnalyticsListener() {
@Override
public void onReceived(long timeTakenInMillis, long bytesSent, long bytesReceived, boolean isFromCache) {
Log.d(TAG, " timeTakenInMillis : " + timeTakenInMillis);
Log.d(TAG, " bytesSent : " + bytesSent);
Log.d(TAG, " bytesReceived : " + bytesReceived);
Log.d(TAG, " isFromCache : " + isFromCache);
}
})
.setDownloadProgressListener(new DownloadProgressListener() {
@Override
public void onProgress(long bytesDownloaded, long totalBytes) {
Log.d(TAG, "bytesDownloaded : " + bytesDownloaded + " totalBytes : " + totalBytes);
Log.d(TAG, "setDownloadProgressListener isMainThread : " + String.valueOf(Looper.myLooper() == Looper.getMainLooper()));

}
})
.startDownload();

if (download.isSuccess()) {
Log.d(TAG, "checkSynchronousCall : download success");
Expand Down

0 comments on commit 7ff4905

Please sign in to comment.