Wednesday, August 23, 2017

Android Adding File Certificate To Retrofit 2.0+



After the previous post about how to adding file certificate to Retrofit 1.7, today i gonna share a new tutorial about how to adding file certificate to Retrofit 2.0.


As you know, one of usage of file certificate is used to access HTTPS from HTTP. If your current host is HTTPS but you still access using HTTP , so by using file certificate it will be redirecting to HTTPS automatically.

Before you adding file certificate to Retrofit 2.0 make you using OKHTTP 3 for your client. So here is the method that you can use for adding file certificate to Retrofit 2.0 :

First import the following package :

Here the method that i use in my project, write the following method (you can modify the method as you wish) :

That's all, hope it helps and works. Thank you.

Related Posts


EmoticonEmoticon