Skip to content
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

[Bug]: Sound not playing on Android 11 / Android 13 #1534

Open
2 of 3 tasks
jbrodriguez opened this issue Jul 24, 2023 · 7 comments
Open
2 of 3 tasks

[Bug]: Sound not playing on Android 11 / Android 13 #1534

jbrodriguez opened this issue Jul 24, 2023 · 7 comments

Comments

@jbrodriguez
Copy link

What happened?

i set up 3 emulators on my mac

  • Pixel 3a (with Android 13)
  • Pixel 5 (with Android 12)
  • Pixel 5 (with Android 11)

i then pushed a notification with a custom sound, it worked on android 12, but doesn't work on android 11 or android 13

Steps to reproduce?

1. Install react-native-onesignal v4.5.1 on React Native 0.71.12
2. Push a notification with custom sound with the app killed
3. Wait for the notification sound

What did you expect to happen?

i expected the custom sound to be played, but it doesn't on android 11 nor android 13, it does work on android 12 🤷‍♂️

please note that i've placed the custom sound in both

  • /app/res/raw
  • /app/src/main/res/raw

React Native OneSignal SDK version

4.5.1

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: Work [ id=c1f1f0fe-08a1-48ef-b45f-4278fa9653f7, tags={ FOCUS_LOST_WORKER_TAG, com.onesignal.OSFocusHandler$OnLostFocusWorker } ] failed because it threw an exception/error
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:516)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:311)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at java.lang.Thread.run(Thread.java:1012)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSUtils.packageInstalledAndEnabled(OSUtils.java:275)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSUtils.isGMSInstalledAndEnabled(OSUtils.java:288)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSUtils.supportsGooglePush(OSUtils.java:330)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSUtils.getDeviceType(OSUtils.java:349)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSUtils.isAndroidDeviceType(OSUtils.java:371)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.LocationController.isGooglePlayServicesAvailable(LocationController.java:337)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.LocationController.onFocusChange(LocationController.java:325)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1352)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSFocusHandler$Companion.onLostFocusDoWork(OSFocusHandler.kt:144)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at com.onesignal.OSFocusHandler$OnLostFocusWorker.doWork(OSFocusHandler.kt:123)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	at androidx.work.Worker$1.run(Worker.java:86)
07-24 15:42:00.462 10477 10511 E WM-WorkerWrapper: 	... 3 more
07-24 15:42:00.467 10477 10511 I WM-WorkerWrapper: Worker result FAILURE for Work [ id=c1f1f0fe-08a1-48ef-b45f-4278fa9653f7, tags={ FOCUS_LOST_WORKER_TAG, com.onesignal.OSFocusHandler$OnLostFocusWorker } ]

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jbrodriguez
Copy link
Author

additionally, this is the settings on an android 13, the custom sound is set, but it just doesn't play

Screenshot_1690292594

@jennantilla
Copy link
Contributor

Hi @jbrodriguez thank you for reaching out! We're working on reproducing this and will get back to you as soon as possible.

@lucasfontinele
Copy link

Any updates about this one?

@Kasik-D
Copy link

Kasik-D commented Aug 3, 2023

Hello, I use react-native: 0.69.5 and react-native-onesignal: "^4.5.1"

And after testing, our team noticed that on Android version 12, push notifications come without sound,
we set up custom sound, but it does not work on android version 12.

@pranshuchittora
Copy link

I am also not able to play the custom notification sound on Android.
On the latest version of the OneSignal RN SDK

@Janskiproducer
Copy link

I'm having trouble too!

@marshall86
Copy link

same issue with the ionic integration. Any update on the matter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants