A while back I wrote about “Using SSL right on Android“. If you are using OkHttp and/or Retrofit, this should be quite simple to implement. You can use the CertificatePinner class when building your OkHttpClient instance.
- CertificatePinner certificatePinner = new CertificatePinner.Builder()
- .add("example.com", "your_pin")
- new OkHttpClient.Builder()
More details about HTTPS and certificate pinning with OkHttp can be found on their Wiki, as well as a full example.