Skip to content

[Bug]: Channel with custom sound fails to play sound after rebuild / update #2245

Description

@armiiller

What happened?

When trying to deploy an app update (aka rebuilding and distributing), sending notifications to a channel with a custom sound no longer play the sound. I still receive a vibration, and push notification, just the sound is not played.

This is a result of the sound Uri being built using the resources id. When doing a grade rebuild, ids will change. Thus the channel is trying to play a resource that no longer exists.

if (soundId != 0) return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + packageName + "/" + soundId)

Other similar projects have dealt with similar issues with fixes.

Steps to reproduce?

1. Build your app. Install. Run the app to create the notification channels. Send at least on push notification to the channel.
2. Build a new version, with added sound files (as to cause gradle to rebuild and remap resources). Make sure to update your version code. Install on phone that had previous version installed. Send push notification to same channel. Custom sound will not play.

What did you expect to happen?

I expected the custom channel sound to play when a push notification is received (because we are technically passing a string) and app updates/rebuilds should not cause failures.

OneSignal Android SDK version

Release 4.8.10

Android version

14

Specific Android models

Should affect all models. And all versions. It's very clear in the code that a resource path using build ids will fail.

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    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