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

Please support Ongoing Activity API on wear. #1975

Open
Digipom opened this issue Dec 13, 2024 · 3 comments
Open

Please support Ongoing Activity API on wear. #1975

Digipom opened this issue Dec 13, 2024 · 3 comments
Assignees

Comments

@Digipom
Copy link

Digipom commented Dec 13, 2024

[REQUIRED] Use case description

We want to be able to customize the default ongoing activity.

Proposed solution

It should be possible to provide a hook to the NotificationCompat.Builder() so we can call OngoingActivity APIs. See: https://developer.android.com/training/wearables/notifications/ongoing-activity

Alternatives considered

It's only currently possible if all default notification handling is completely replaced, which is not ideal. OngoingActivity.recoverOngoingActivity(context) doesn't work with the system-provided ongoing activity.

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Dec 13, 2024

Thanks for reporting!

It should be possible to provide a hook to the NotificationCompat.Builder() so we can call OngoingActivity APIs.

From the docs you only need to call

.setSmallIcon(..)
 .setOngoing(true)

on APIs that Media3 hides internally. Is this correct? The other APIs are Wear specific and we are not obscuring these or something if I understand correctly.

You can already call DefaultMediaNotificationProvider.setSmallIcon(resId).

So all you need is a setter to set the ongoing flag to true or false to your liking.

Can you please confirm whether this is correct, or then let us know what else you would need.

@Digipom
Copy link
Author

Digipom commented Dec 13, 2024

@marcbaechinger It seems that the ongoing activity builder needs the NotificationCompat.Builder and I also have to create the ongoing activity before NotificationCompat.Builder.build(). I can do this if I replace all of media3's notification stuff with my own, but I'd rather just leverage media3.

Wear already does provide a default ongoing activity so this is just if we want to customize that activity.

@marcbaechinger
Copy link
Contributor

Ah, yeah, I see how the builder is passed into the activity.

I think we should sync with the Wear OS team how to provide a good solution for their users. Will do that. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants