-
-
Notifications
You must be signed in to change notification settings - Fork 694
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
Initial notification ignores custom notificationHandlerFactory #634
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Bump |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
@gotev would you consider this being relevant for the library? |
@PhilLab thank you for this detailed report and proposed solution, much appreciated! Made a PR #648 The very first notification is inteded to be constructed like that, as it serves the sole purpose of guaranteeing service launch. The NotificationHandler Factory serves a different purpose: to allow you to control how each of the uploads notifications are shown. The very first notification is something which Android requires to be there for the service to be launched. The NotificationHandler does its job after the service is started. If the docs are not clear about this aspect, every suggestion is welcome to improve them. |
Merged the PR and released version |
@gotev thank you, very much appreciated! |
Describe the bug
The initial notification does not use the
NotificationHandlerFactory
which you can set byUploadServiceConfig.setNotificationHandlerFactory()
. Instead it is created standalone:https://github.com/gotev/android-upload-service/blob/master/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.kt#L206
This means that if you applied any special handling, it won't work for the very first notification
This is a bigger issue on Samsung devices, because they have a crash bug for which the workaround cannot be injected into the upload service:
android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.example.app/net.gotev.uploadservice.UploadService
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { builder.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE); }
when creating a notification in the background.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The creation of the very first notification should also use the notification factory, if a custom one was provided.
The text was updated successfully, but these errors were encountered: