Skip to content

Implement play audio from push notification #3541

@plumberg

Description

@plumberg

Hi,

I am working on adding a push-to-talk feature to the app. I was able to implement everything I need, until I ran into the issue with receiving audio while the app is in a background.
So, I tried sending a link to the audio in the push notification. The idea is that push callback should play the audio from the link the moment the push is received.
The code in push(String value) is something like

Media audio = MediaManager.createBackgroundMedia(value);
           // audio.prepare();
            Display.getInstance().callSerially(() -> {
                audio.setNativePlayerMode(false);
                audio.play();
            });

The problem is, it's not working when the app is in background.
For iOS, I've added codename1.arg.ios.background_modes=location,remote-notification,audio,music.
For android, audio playing from push used to work, but for some reason now it has the same issue - now it works only in foreground.

I know that it should be possible to implement, because there are apps that can do what I am trying to achieve (For example, Zello).
Also, based on this StackOverFlow Q&A, it should be possible.
https://stackoverflow.com/a/65563470/8921111

I'll appreciate any ideas and help on this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions