Skip to content

Commit

Permalink
Change OkHttp to 3.12 to work on under 21 android versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ABPSoft committed Apr 4, 2019
1 parent 97fe0bc commit 6b31432
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ABPWebService/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.squareup.okhttp3:okhttp:3.14.0"
implementation "com.squareup.okhttp3:okhttp:3.12.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,19 @@ public void writeTo(BufferedSink sink) throws IOException
};
}


OkHttpClient client=new OkHttpClient.Builder()
.connectTimeout(connectTimeout,TimeUnit.MILLISECONDS)
.readTimeout(readTimeout,TimeUnit.MILLISECONDS)
.writeTimeout(readTimeout,TimeUnit.MILLISECONDS)
.build();

Request request=new Request.Builder()
.url(url)
.post(requestBody)
.build();

try
{
OkHttpClient client=new OkHttpClient.Builder()
.connectTimeout(connectTimeout,TimeUnit.MILLISECONDS)
.readTimeout(readTimeout,TimeUnit.MILLISECONDS)
.writeTimeout(readTimeout,TimeUnit.MILLISECONDS)
.build();

Request request=new Request.Builder()
.url(url)
.post(requestBody)
.build();

client.newCall(request).enqueue(new Callback()
{
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public void onClick(View view)
private void sendRequest()
{
ABPWebService abpWebService=new ABPWebService();
abpWebService.setUrl("https://14bazikon.com/api/users/login");
//abpWebService.setUrl("https://14bazikon.com/api/users/login");
abpWebService.setUrl("http://api.apiservice.info/");
//abpWebService.setUrl("https://api.github.com/repos/square/okhttp/issues");

//Check Permission in the feature
Expand Down

0 comments on commit 6b31432

Please sign in to comment.