[Android] Customize UploadNotificationConfig
See original GitHub issueHello,
I’m writing an android application and I need to customize the behavior of upload notifications. My app does several small uploads in a short moment so i would like to disable the ringtone sound and to hide the notifications on upload success.
These options can be managed in UploadNotificationConfig object of android-upload-service library (here the docs), but are not customizable during creation of new background-http task.
here, the lines involved in task creation:
background-http.android.ts
130. request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
...
186. request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
Do you have any suggestion on how to modify nativescript-background-http to enable these options without breaking too much the compatibility with ios platform? or maybe another way to get the same result?
thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
"Bad notification for startForeground" error when using ...
So, in order to fix, you must create UploadNotificationConfig, set a notification channel then, you can set it to the upload request. Start...
Read more >MultipartUploadRequest (Android Upload Service 3.0.1 ...
Sets the custom user agent to use for this upload request. ... public MultipartUploadRequest setNotificationConfig(UploadNotificationConfig config).
Read more >Uploading image with MultiuploadRequest - Mobile
<uses-permission android:name=… ... setNotificationConfig(new UploadNotificationConfig()) .setMaxRetries(2) .startUpload(); //Starting the ...
Read more >Android Upload Image using Android Upload Service
So its working absolutely fine. Now lets move ahead and create a android project. ... setNotificationConfig(new UploadNotificationConfig()).
Read more >net.gotev.uploadservice.UploadRequest.self java code ...
origin: gotev/android-upload-service ... be displayed * @return self instance */ public B setNotificationConfig(UploadNotificationConfig config) { params.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I edited the the
background-http.android.ts
file once again and made the notification disappear completely.Please consider adding this functionally to your plugin in your next update.
Thanks!
The change that i made was to comment this section:
var displayNotificationProgress = typeof options.androidDisplayNotificationProgress === "boolean" ? options.androidDisplayNotificationProgress : true; if (displayNotificationProgress) { request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig()); }
Released in nativescript-background-http@4.1.0