Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the right content-type header for consumption reports and add han… #53

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,13 @@ class MediaSessionHandlerMessengerService() : Service() {

call?.enqueue(object : retrofit2.Callback<Void?> {
override fun onResponse(call: Call<Void?>, response: Response<Void?>) {
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<Void?>, t: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand Down
Loading