Skip to content

Instantly share code, notes, and snippets.

View Sanjay-Prajapati's full-sized avatar
🎯
Focusing

sanjay prajapati Sanjay-Prajapati

🎯
Focusing
  • Ahmedabad, Gujarat, India
View GitHub Profile
@Sanjay-Prajapati
Sanjay-Prajapati / LogoutInterceptor.kt
Last active January 8, 2019 10:27
Retrofit2 custom interceptor that parse the response from API. After that we can check status and based on that returns a same copy that other classes can consume.
import com.google.gson.Gson
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.ResponseBody
import org.json.JSONException
/**
* Logout Interceptor.
* Here i extend the BaseActivity to navigate user to another screen. i need runOnUIThread to execute navigateToLogin() method.