Skip to content

Instantly share code, notes, and snippets.

View balrampandey19's full-sized avatar
🎯
Focusing

Balram Pandey balrampandey19

🎯
Focusing
View GitHub Profile
@balrampandey19
balrampandey19 / gist:da57598d2078b27bf802285d469a76c9
Created October 24, 2016 09:43
Retrofit 2.0 to String converter
If you are using Protocol buffer or Flat buffer and want to get Byte String response for server-:
```
public class ToStringConverterFactory extends Converter.Factory {
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if (String.class.equals(type)) {
return new Converter<ResponseBody, String>() {
@balrampandey19
balrampandey19 / gist:96bdc04174e58ba3dd03c0aa6f7345af
Created December 29, 2016 07:24
Encrypt retrofit request body with SHA256
/**
* Created by Balram Pandey on 12/29/16.
*/
public class EncryptionInterceptor implements Interceptor {
private static final String TAG = EncryptionInterceptor.class.getSimpleName();
private static final boolean DEBUG = true;