Comments (14)
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()); }
from nativescript-background-http.
Hi @farzeni,
I reviewed your case on my side, however, at this time there is no appropriate way to set up this options from code behind.
Regarding that, I log this issue as a new feature.
In the meantime, I could suggest setting those options inside the background-http.android.ts
file as you have mentioned and to create your local tgz
, which you could use in your project. You could follow the below-attached steps.
git clone https://github.com/NativeScript/nativescript-background-http
- add in
nativescript-background-http/background-http.android.ts
file following settings inside thecreate
method.
static create(session: Session, file: string, options: common.Request): Task {
var task = new Task();
task._session = session;
task._id = session.id + "{" + ++Task.taskCount + "}";
var context = application.android.context;
var request = new (<any>net).gotev.uploadservice.BinaryUploadRequest(context, task._id, options.url);
request.setFileToUpload(file);
request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
request.setFileToUpload(file);
request.setRingToneEnabled(false);
var headers = options.headers;
if (headers) {
for (var header in headers) {
var value = headers[header];
if (value !== null && value !== void 0) {
request.addHeader(header, value.toString());
}
}
}
npm install
4,npm run tsc
npm pack
the newly created tgz file could installed with tns plugin add <path to the file>
from nativescript-background-http.
Umm... I don't think this works, I get
JS: ERROR TypeError: request.setRingToneEnabled is not a function
from nativescript-background-http.
Hi, i also tried your suggested fix and got the same error.
TypeError: request.setRingToneEnabled is not a function
from nativescript-background-http.
+1
from nativescript-background-http.
if you read the code you commented out, you will realize you can include the boolean flag 'androidDisplayNotificationProgress' in the options array passed to either 'uploadFile' or 'multipartUpload' (set to false to omit the notification).
thanks for pointing it out, looking at this thread is what finally made that option and its use click. :)
from nativescript-background-http.
@bniehuser - Thank you for pointing that out!
from nativescript-background-http.
+1
from nativescript-background-http.
@bniehuser note this doesn't appear to work for recent android versions. See #148
from nativescript-background-http.
Currently I am facing two issues with the plugin :
- I am using nativescript-imagecropper with nativescript-background-http and it was working properly before updating the plugin nativescript-background-http to latest version and nativescript to 4.1.0 . But now app crashes with following error:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.proxible.innercircle.uploadservice.broadcast.status flg=0x10 pkg=com.proxible.innercircle (has extras) } in net.gotev.uploadservice.UploadServiceBroadcastReceiver_http_91_87_@61a749f
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_53427(LoadedApk.java:1356)
at android.app.-$Lambda$FilBqgnXJrN9Mgyks1XHeAxzSTk.$m$0(Unknown Source:4)
at android.app.-$Lambda$FilBqgnXJrN9Mgyks1XHeAxzSTk.run(Unknown Source:0)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6798)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: com.tns.NativeScriptException:
Calling js method onCompleted failed
- Another issue is that I need to disable upload notification on android but options.androidDisplayNotificationProgress is no longer available in recent version and above suggestions are not working.
Please suggest solutions asap.
from nativescript-background-http.
@tomshabtay, Would you have this file updated.? I wanted to copy it. Do you know about any course that explains how to create plugins, sometimes I need change something on code but give up on the same time because of complexity of them.
from nativescript-background-http.
@manoldonev i used tsonevn explanation in this thread to edit the plugin.
I uploaded the edited plugin I used
nativescript-background-http-3.1.0.zip
from nativescript-background-http.
This feature has been implemented is merged with #239
from nativescript-background-http.
Released in [email protected]
from nativescript-background-http.
Related Issues (20)
- IOS internal server error 502
- Ability to set timeout HOT 1
- Does this plugin work to upload images to S3 buckets? HOT 1
- Access Server Response After Upload Completed
- Nativescript 7 Error HOT 11
- Weird task event data HOT 2
- [IOS] Failed to issue sandbox HOT 1
- Use with nativescript-ssl-pinning
- Class constructor Observable cannot be invoked without 'new'. HOT 5
- Error on upload image, no response and respondeCode -1 HOT 6
- An uncaught Exception occurred on "pool-3-thread-1" thread. HOT 1
- An uncaught error on background image uploading HOT 8
- An uncaught Exception : Context.startForegroundService() HOT 1
- Image error after upload
- 503 error after upgrade to NS 7
- Targeting Android Version 31 - crashes with java.lang.reflect.InvocationTargetException HOT 12
- [Android] Unable to handle error response coming from server
- IOS upload - Payload too large
- illegalArgumentException: defaultNotificationChannel HOT 2
- Nativescript multipartUpload fails/crashes in android 31 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-background-http.