Skip to content

Playback resumption notification not showing for API 31+ with MediaSessionService #933

Open
@svenoaks

Description

@svenoaks

Version

Media3 1.2.0

More version details

No response

Devices that reproduce the issue

API 31-34 emulators, some physical devices tested also

Devices that do not reproduce the issue

<= Api 30 emulators, some physical devices tested also

Reproducible in the demo app?

Not tested

Reproduction steps

This is an extension of the comments for #672, we would like to have a MediaSessionService app post a playback resumption notification on all API levels

manifest permissions:

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

where applicable, the POST_NOTIFICATIONS is granted at runtime prior to restarting the app and demonstrating the behavior

service declaration:

<service
            android:name=".player.PlaybackService"
            android:foregroundServiceType="mediaPlayback"
            android:exported="true">
            <intent-filter>
                <action android:name="androidx.media3.session.MediaSessionService"/>
                <action android:name="android.media.browse.MediaBrowserService"/>
            </intent-filter>
        </service>

playback resumption is implemented and working on all API levels

On the stated API levels, started playback, then paused and put the app in the background

Expected result

after a couple of minutes of the app being in the background, the normal notification disappears and a playback resumption notification appears with a play button only on all API levels

On API 30, we get logs such as these:

2023-12-29 12:12:05.386   684-684   MediaResumeListener     com.android.systemui                 D  Checking for service component for com.smp.musicspeed
2023-12-29 12:12:05.387   684-760   MediaResumeListener     com.android.systemui                 D  Testing if we can connect to ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}
2023-12-29 12:12:05.436   684-684   MediaResumeListener     com.android.systemui                 D  Checking for service component for com.smp.musicspeed
2023-12-29 12:12:05.446   684-760   MediaResumeListener     com.android.systemui                 D  Testing if we can connect to ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}
2023-12-29 12:12:05.477   684-684   MediaResumeListener     com.android.systemui                 D  Checking for service component for com.smp.musicspeed
2023-12-29 12:12:05.483   684-760   MediaResumeListener     com.android.systemui                 D  Testing if we can connect to ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}
2023-12-29 12:12:05.522   684-760   MediaResumeListener     com.android.systemui                 D  yes we can resume with ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}

Actual result

On the states API levels, the normal notification is removed, but a playback resumption notification does not appear

On API 31+, we get logs such as these:

2023-12-29 12:13:48.109   747-747   MediaResumeListener     com.android.systemui                 D  Checking for service component for com.smp.musicspeed
2023-12-29 12:13:48.109   747-864   MediaResumeListener     com.android.systemui                 D  Testing if we can connect to ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}
2023-12-29 12:13:48.199   747-864   MediaResumeListener     com.android.systemui                 D  Connected to ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}
2023-12-29 12:13:48.201   747-864   MediaResumeListener     com.android.systemui                 E  Cannot resume with ComponentInfo{com.smp.musicspeed/com.smp.musicspeed.player.PlaybackService}

Media

not applicable

Bug Report

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions