Android 4.x RemoteControlClient.setTransportControlFlags() not working?

后端 未结 2 1765
悲&欢浪女
悲&欢浪女 2021-02-14 21:40

I\'m trying to use the RemoteControlClient class to support the lock screen player with my app. One issue is that setting the transport control flags seems like they don\'t wor

2条回答
  •  情话喂你
    2021-02-14 22:15

    The FLAG_KEY_MEDIA_STOP never shows stop because of bug in android as reported here: https://code.google.com/p/android/issues/detail?id=29920

    If you use the flag PLAY_PAUSE is should not produce a KEYCODE_MEDIA_STOP event. Why would it? It is a play/pause toggle action that does what it is intended to. It is up to your application to store the state of your media player.

    If I understand the documentation correctly you could get KEYCODE_MEDIA_PLAY or KEYCODE_MEDIA_PAUSE only if you use the flags FLAG_KEY_MEDIA_PLAY and FLAG_KEY_MEDIA_PAUSE. But android might be "clever" and translate it to a toggle. I'm not sure about that.

提交回复
热议问题