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]: INotificationServiceExtension not call in release apk, but work in debug mode #2044

Open
1 task done
welcome14 opened this issue Apr 5, 2024 · 3 comments
Open
1 task done

Comments

@welcome14
Copy link

welcome14 commented Apr 5, 2024

What happened?

the service INotificationServiceExtension is called when i use a debug mode, but when i create a build in release mode, the service not work.

minSdkVersion 21
targetSdkVersion 34
compileSdk 34
buildToolsVersion '35.0.0 rc2'

implementation 'com.onesignal:OneSignal:5.1.7'

Gradle 8.7

write in java language

Steps to reproduce?

send notification with app in background.

What did you expect to happen?

null

OneSignal Android SDK version

34

Android version

13

Specific Android models

No response

Relevant log output

null

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jkasten2
Copy link
Member

jkasten2 commented Apr 5, 2024

@welcome14 we need a bit more information to investigate:

  1. Can you add @Keep to your class the implements INotificationServiceExtension?
    • This will make sure your class is not renamed or removed due to minification setting you may have on release
  2. Do you get any errors in the logcat?
    • Enable OneSignal Verbose logging if you are not seeing any errors.
  3. Can you try disabling all minification in your release build?
    • Progurd, R8, etc.

@welcome14
Copy link
Author

i have disable the minification, and it works!

buildTypes {
release {
minifyEnabled true
}
}

@jkasten2
Copy link
Member

jkasten2 commented Apr 8, 2024

@welcome14 does adding @Keep to your class also solve the problem? As it is recommended to use minification in release builds.

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

No branches or pull requests

2 participants