-
Notifications
You must be signed in to change notification settings - Fork 652
Add action to startSelfIntent to easily distinguish it as app #2833
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
base: main
Are you sure you want to change the base?
Conversation
| mainHandler = Util.createHandler(Looper.getMainLooper(), /* callback= */ this); | ||
| mainExecutor = (runnable) -> Util.postOrRun(mainHandler, runnable); | ||
| startSelfIntent = new Intent(mediaSessionService, mediaSessionService.getClass()); | ||
| startSelfIntent.setAction("androidx.media3.session.MediaNotificationManager.START_SELF_INTENT"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this MediaSessionService. Agreed the origin is the MediaNotificationManager.
And the I think it would make sense to add this as a public constant to MediaSessionService, so that an app would be able to compare the action easily and then discard the intent as a no-op.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the feedback. I agree with your idea and did it for this and the other missing Intent action.
7edcad7 to
b32a5ba
Compare
|
Thanks. I will take that.
Just as an aside. Above API 31 the only action that should arrive in As a developer I would actually never need to override this method I think. If you do that you can, but you would be responsible for doing this in a way that doesn't break the state handling of the service. If an app is sending such If it was about me, I'm going to adjust the documentation you added accordingly. Please refrain from pushing further changes. |
I was debugging start commands I shouldn't be recieving, and the startSelfIntent with empty action was sort of confusing because it wasn't immediately obvious where it came from. Adding a unique action string doesn't have any ill effects and allows easily identifying these intents in onStartCommand().
|
I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks! |
b32a5ba to
2bd532c
Compare
I was debugging start commands I shouldn't be recieving, and the startSelfIntent with empty action was sort of confusing because it wasn't immediately obvious where it came from. Adding a unique action string doesn't have any ill effects and allows easily identifying these intents in onStartCommand().