I have implemented this in a dummy project . I am using json value to login in my App but I am getting End of character in response.
RestrofitService
@post("/****/services/testing.php")
fun getPosts(@Body jsonRequest: String): Deferred<Response>
Login Method
private fun initLogin() {
val service = RetrofitFactory.makeRetrofitService()
GlobalScope.launch(Dispatchers.Main) {
val request = service.getPosts(Utils.jsonRequest(et_loginId.text.toString(),et_loginPwd.text.toString()))
try {
val response = request.await()
response.body()?.let {
toast("Hii")
}
} catch (e: HttpException) {
toast(e.code())
} catch (e: Throwable) {
toast(e.message.toString()) //this toast showing
}
}
}
Response JSON Format I am successfully getting when I am hitting URL.
{
"status": 1,
"message": "success",
"data": {
"sno": "1",
"unique_user_id": "1",
"username": "krishna",
"password": "AHUnB49vJMlhKk69w/Kpnw==",
"name": "krishna",
"mobile": "123",
"date": "2019/02/06",
"visible": "1"
}
}
Data Class of Feedback I just want to get status of response. So I have only used status and message.
data class Feedbacks(@SerializedName("status") var status: Int, @SerializedName("message") var message: String)