Audio_service: The action in the notification does not work

Created on 21 Jun 2020  路  7Comments  路  Source: ryanheise/audio_service

ios still works fine, but with Android when I click the action on the notification it doesn't work.

Do you know what is preventing this action from working, please let me know, I'll fix it myself

Screenshot_1592735995

This is my code
Screen Shot 2020-06-21 at 11 31 53 PM

Screen Shot 2020-06-21 at 11 32 09 PM

I went into the code, and this function was not called

Screen Shot 2020-06-21 at 11 20 21 PM

1 backlog question

Most helpful comment

Yep, sorry about that ;-) It was suggested that I move to a 1.0 release recently, but I knew that I still had a number of API issues to resolve before then. I would say there is still one major API issue left, which is to allow the service to be responsive even when it isn't in the foreground, and to allow a notification to persist and be responsive even after the app is stopped (on Android). This not only addresses #367 but a whole range of long-standing issues such as Android Auto, and basically anyone who has struggled to share a single source of truth from the background isolate when it is not always present.

All 7 comments

Have you configured the AndroidManifest.xml correctly? If iOS works fine, it could be android side configure issue.

@stonega I think nothing is missing. I think nothing is missing, because the icon was displayed, the problem is that it doesn't receive the click event

Screen Shot 2020-06-22 at 10 35 45 AM

@trighomautumnatg If you are using version above 0.10.0, you need to change it. You can see more in README.md about migrating to 0.10.0.

    <receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver" >
      <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
      </intent-filter>
    </receiver> 

@stonega thanks, I did not notice this change

@stonega 's helpful advice is correct (thanks!)

I have wondered recently whether I should put this configuration into the plugin itself so it happens automatically. However, that also would make it difficult for users to customise their own broadcast receiver in cases where they have a requirement imposed by a different plugin.

@stonega 's helpful advice is correct (thanks!)

I have wondered recently whether I should put this configuration into the plugin itself so it happens automatically. However, that also would make it difficult for users to customise their own broadcast receiver in cases where they have a requirement imposed by a different plugin.

Because I had the same issue when I tried to update from 0.8.0 to 0.10.0 recently, I found a lot things have changed, I decide to use 0.8.0 until you push slower LOL
PS I think it is unnecessary to put it in plugin, it is very easy and common to configure AndroidManifest.
Thanks for your work!

Yep, sorry about that ;-) It was suggested that I move to a 1.0 release recently, but I knew that I still had a number of API issues to resolve before then. I would say there is still one major API issue left, which is to allow the service to be responsive even when it isn't in the foreground, and to allow a notification to persist and be responsive even after the app is stopped (on Android). This not only addresses #367 but a whole range of long-standing issues such as Android Auto, and basically anyone who has struggled to share a single source of truth from the background isolate when it is not always present.

Was this page helpful?
0 / 5 - 0 ratings