diff --git a/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/MediaSessionHandlerMessengerService.kt b/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/MediaSessionHandlerMessengerService.kt index 7550696..b6905c8 100644 --- a/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/MediaSessionHandlerMessengerService.kt +++ b/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/MediaSessionHandlerMessengerService.kt @@ -570,7 +570,13 @@ class MediaSessionHandlerMessengerService() : Service() { call?.enqueue(object : retrofit2.Callback { override fun onResponse(call: Call, response: Response) { - Log.d(TAG, "Successfully send consumption report") + when(val responseCode = response.code()) { + 204 -> Log.d(TAG, "Consumption Report: Accepted") + 400 -> Log.d(TAG, "Consumption Report: Bad Request") + 415 -> Log.d(TAG, "Consumption Report: Unsupported Media Type") + else -> Log.d(TAG, "Consumption Report: Return code $responseCode") + } + } override fun onFailure(call: Call, t: Throwable) { diff --git a/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/network/ConsumptionReportingApi.kt b/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/network/ConsumptionReportingApi.kt index a0194dd..4cd6c20 100644 --- a/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/network/ConsumptionReportingApi.kt +++ b/app/src/main/java/com/fivegmag/a5gmsmediasessionhandler/network/ConsumptionReportingApi.kt @@ -12,10 +12,12 @@ package com.fivegmag.a5gmsmediasessionhandler.network import okhttp3.RequestBody import retrofit2.Call import retrofit2.http.Body +import retrofit2.http.Headers import retrofit2.http.Path import retrofit2.http.POST interface ConsumptionReportingApi { + @Headers("Content-Type: application/json") @POST("consumption-reporting/{provisioningSessionId}") fun sendConsumptionReport( @Path("provisioningSessionId") provisioningSessionId: String?,