Closed albertleao closed 1 year ago
Hi @albertleao could you try this branch ? https://github.com/spoonconsulting/cordova-plugin-background-upload/pull/84 and let us now if you are having the same issue ? Thanks.
@ombr Hey! I'll be able to test this tonight and let you know.
@ombr Unfortunately that branch did not work. I had the following error on upload:
FileTransferManager.js:11 Uncaught (in promise) Error: event handler must be a function
at new FileTransferManager (FileTransferManager.js:11)
at Object.init (FileTransferManager.js:89)
To get the plugin installed, I also had to download that branch locally and remove the <edit-config>
for the Android:Name for there not to be any clashes.
I have the exact same issue. Any updates on the fix? Though it works some time from an android emulator with api 29, but never on an actual device.
Hi @albertleao @koczka, we are still working on the new version.
Could you try this branch ? afnetworking-spx-demo
We will replace the current master with this new version in a few week.
Sure, I'm going to try it right now.
Edit, can't install from this branch.
Failed to install 'cordova-plugin-background-upload': Error: There was a conflict trying to modify
attributes with <edit-config> in plugin cordova-plugin-background-upload. The conflicting plugin,undefined,
already modified the same attributes. The conflict must be resolved before
cordova-plugin-background-upload can be added. You may use --force to add
the plugin and overwrite the conflicting attributes.
at PlatformMunger.add_plugin_changes (project/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:150:19)
at project/node_modules/cordova-common/src/PluginManager.js:123:29
at _fulfilled (project/node_modules/q/q.js:834:54)
at project/node_modules/q/q.js:863:30
at Promise.promise.promiseDispatch (project/node_modules/q/q.js:796:13)
at project/node_modules/q/q.js:857:14
at runSingle (project/node_modules/q/q.js:137:13)
at flush (project/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11).
There was a conflict trying to modify attributes with <edit-config> in plugin cordova-plugin-background-upload. The conflicting plugin, undefined, already modified the same attributes. The conflict must be resolved before cordova-plugin-background-upload can be added. You may use --force to add the plugin and overwrite the conflicting attributes.
I think you will need to remove your platform and plugin directory and restart a build.
It still fails with the same error on a full clean platform install.
Here's my plugin config:
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-sqlite-storage" spec="^4.0.0" />
<plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.2" />
<plugin name="cordova-plugin-screen-orientation" spec="^3.0.2" />
<plugin name="cordova-plugin-add-swift-support" spec="^2.0.2" />
<plugin name="cordova-plugin-file" spec="^6.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.1.3">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-inappbrowser" spec="^3.2.0" />
<plugin name="cordova-plugin-camera" spec="^4.1.0">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-uniquedeviceid" spec="^1.3.2" />
<plugin name="cordova-plugin-advanced-http" spec="^2.4.1">
<variable name="OKHTTP_VERSION" value="3.10.0" />
</plugin>
<plugin name="cordova-plugin-sequence-order-imagepicker" spec="^1.0.3">
<variable name="ANDROID_SUPPORT_V7_VERSION" value="27.+" />
<variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value=" " />
</plugin>
<plugin name="cordova-plugin-background-upload" spec="~2.0.2" />
I will check on my side and get back to you when we have a new version fixing this.
Thank you for your time! Do you have any updates on this case?
Try
<plugin name="cordova-plugin-background-upload" spec="https://github.com/spoonconsulting/cordova-plugin-background-upload.git#afnetworking-spx-demo" />
instead of
<plugin name="cordova-plugin-background-upload" spec="~2.0.2" />
in your config.xml
Thanks, I was able to install the plugin this way, I'm gonna check the function to see if the uploads are working.
Now there's a new error happening:
Android Oreo requires a notification configuration…ml#startForegroundService(android.content.Intent)
Does the notification appear? Pls paste your entire config.xml
I had the showNotification
set to false, and I got the error above.
I set notifications to true, and it did show up in the notification centre, but now I get the execute failed error again.
{id: "pic-6", error: "execute failed", state: "FAILED"}
I set showNotification
to true
as I stated above, but then I get the original execute failed
error again.
Ok, so paste your upload config because I can't reproduce the error (parameters you pass into startUpload)
Here's an upload object
{
id: `pic-${idx}`,
filePath: path,
fileKey: 'files',
showNotification: true,
serverUrl: url,
headers: {
Authorization: this.token
},
parameters: {
gid: this.galId
}
}
It should work, please check the demo in case you missed something. Let me know if you get the same error with the demo.
The uploads are working now, but I can't seem to get the event callback to fire.
More details pls
I'm using the init function from the demo you linked in your previous command, but I can't see any logs about the events. I'm testing on a huawei mate 10 pro, connected to chrome inspect.
The event is null?
No, it simply doesn't get called.
Could you paste your init?
It's literally copied from the demo, but there you go
Yeah, the upload works fine, but no status updates whatsoever. It's running android 8.0.0
I tested it with the same android version and it works, no error in chrome inspect?
Try to init once platform is ready
this.platform.ready().then(() => { ... });
No error, nor any warning. It runs after platform.ready()
@koczka did you manage to make it work the way you want ? Did you manage to make the demo work on your side ? Thanks.
Used to work just fine, but now identical code always returns the following in my error handler
{id: "20200415_210326.mp4", error: "upload failed"}
Followed by
{id: "20200415_210326.mp4", error: "execute failed", state: "FAILED"}
These are the parameters I pass into the startUpload method:
Running android 10 on a Samsung Galaxy s10+
I'm wondering if it has to do with this: https://stackoverflow.com/a/58934803/2093658
EDIT: After digging in and trying to do a file upload with the regular cordova plugin, i found that using the same uri that this plugin uses results in a "permissions error" This is most likely to do with android 10 scoped storage.