-
-
Notifications
You must be signed in to change notification settings - Fork 50
Update to create a notification channel for SDK 26 and up #140
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
Update to create a notification channel for SDK 26 and up #140
Conversation
Just realized that this is like Pull Request #126. I am using nativescript angular. Is there any update on a resolution cause my app won't work in Android 8 without these changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request. I reviewed the code and have two suggestions to improve it:
-
The tns-platform-declarations reference uses API level 17, so trying to run a TypeScript compiler on the background-http plugin source files will fail because of the new methods (from API 26) in the code. This can probably be fixed with a simple
declare var android;
somewhere at the top of the file. -
I see that there are two places in the code where you need to create a channel and this is done in the same way. Perhaps it will be easier to maintain if you extract the code to a private method and call it where needed.
@lini |
Hi @pauly815 , |
@zbranzov |
@zbranzov |
PR Checklist
What is the current behavior?
#136
#124
What is the new behavior?
Updated background-http.android.ts to check the current SDK version. If SDK 26 or higher, a default notification channel is created and set in the notification config.
This update has been tested on a Samsung S8 emulator running Android 8 and a Samsung S6 running Android 7.
One thing to note, I tried to use the Build.VERSION_CODES.O constant but it didn't seem to work when running on a Samsung S6 with Android 7.
Fixes/Implements/Closes #[136].