Comments (30)
Hi @albertleao could you try this branch ? #84 and let us now if you are having the same issue ? Thanks.
from cordova-plugin-background-upload.
@ombr Hey! I'll be able to test this tonight and let you know.
from cordova-plugin-background-upload.
@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.
from cordova-plugin-background-upload.
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.
from cordova-plugin-background-upload.
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.
from cordova-plugin-background-upload.
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.
from cordova-plugin-background-upload.
I think you will need to remove your platform and plugin directory and restart a build.
from cordova-plugin-background-upload.
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" />
from cordova-plugin-background-upload.
I will check on my side and get back to you when we have a new version fixing this.
from cordova-plugin-background-upload.
Thank you for your time! Do you have any updates on this case?
from cordova-plugin-background-upload.
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
from cordova-plugin-background-upload.
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)
from cordova-plugin-background-upload.
Does the notification appear? Pls paste your entire config.xml
from cordova-plugin-background-upload.
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"}
My config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget CFBundleVersion="9" id="" version="1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name></name>
<description></description>
<author email="" href=""></author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<platform name="android">
<allow-intent href="market:*" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
<application android:networkSecurityConfig="@xml/network_security_config" />
</edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<allow-navigation href="http://localhost:8100" sessionid="18ec1e0c" />
<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-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="https://github.com/spoonconsulting/cordova-plugin-background-upload.git#afnetworking-spx-demo" />
</widget>
from cordova-plugin-background-upload.
I set showNotification
to true
as I stated above, but then I get the original execute failed
error again.
from cordova-plugin-background-upload.
Ok, so paste your upload config because I can't reproduce the error (parameters you pass into startUpload)
from cordova-plugin-background-upload.
Here's an upload object
{
id: `pic-${idx}`,
filePath: path,
fileKey: 'files',
showNotification: true,
serverUrl: url,
headers: {
Authorization: this.token
},
parameters: {
gid: this.galId
}
}
from cordova-plugin-background-upload.
It should work, please check the demo in case you missed something. Let me know if you get the same error with the demo.
from cordova-plugin-background-upload.
The uploads are working now, but I can't seem to get the event callback to fire.
from cordova-plugin-background-upload.
More details pls
from cordova-plugin-background-upload.
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.
from cordova-plugin-background-upload.
The event is null?
from cordova-plugin-background-upload.
No, it simply doesn't get called.
from cordova-plugin-background-upload.
Could you paste your init?
from cordova-plugin-background-upload.
It's literally copied from the demo, but there you go
Init code
init() {
console.log('file uploader init');
this.uploader = FileTransferManager.init(
{
parallelUploadsLimit: 2,
notificationTitle: 'Upload service',
notificationContent: 'Background upload service running'
},
event => {
console.log('EVENT');
var correspondingMedia = this.getMediaWithId(event.id);
if (!correspondingMedia) {
return;
}
if (event.state == 'UPLOADED') {
console.log('upload: ' + event.id + ' has been completed successfully');
console.log(event.statusCode, event.serverResponse);
correspondingMedia.updateStatus('uploaded successfully');
} else if (event.state == 'FAILED') {
if (event.id) {
console.log('upload: ' + event.id + ' has failed');
correspondingMedia.updateStatus('Error while uploading');
} else {
console.error('uploader caught an error: ' + event.error);
}
} else if (event.state == 'UPLOADING') {
console.log('uploading: ' + event.id + ' progress: ' + event.progress + '%');
correspondingMedia.updateStatus('uploading: ' + event.progress + '%');
}
if (event.eventId) this.uploader.acknowledgeEvent(event.eventId);
}
);
}
from cordova-plugin-background-upload.
Yeah, the upload works fine, but no status updates whatsoever. It's running android 8.0.0
from cordova-plugin-background-upload.
I tested it with the same android version and it works, no error in chrome inspect?
from cordova-plugin-background-upload.
Try to init once platform is ready
this.platform.ready().then(() => { ... });
from cordova-plugin-background-upload.
No error, nor any warning. It runs after platform.ready()
from cordova-plugin-background-upload.
@koczka did you manage to make it work the way you want ? Did you manage to make the demo work on your side ?
Thanks.
from cordova-plugin-background-upload.
Related Issues (20)
- minCompileSDK(31) specified in a dependency's AAR metadata androidx.work:work-runtime:2.7.1 HOT 3
- How to modify FileUploader.m to use basic PUT request (not multipart) HOT 2
- Uploads fail due to multipart/mixed HOT 1
- UPLOADED event fires off when the responseCode is 4xx HOT 6
- Upload fails silently when using cordova-labs-local-webserver on iOS HOT 2
- Upload by 64encoded content not uri path + Background Download HOT 3
- File Upload's don't work if the file has a "space" in the filename. IOS & Android HOT 1
- File not found (Android) HOT 38
- "[email protected]" does not satisfy dependency plugin requirement HOT 7
- Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent HOT 6
- Is there a way to get the list of pending upload tasks? HOT 2
- Supported Android Versions? HOT 1
- Unable to install 2.0.7 HOT 12
- Unable to specify mime type
- error: 'Upload Settings object is missing or has invalid arguments' HOT 1
- this.uploader.on(...) is not a function HOT 3
- File not found since Capacitor 5 HOT 1
- Unable to remove queued upload
- initializing FileTransferManager twice causes callbacks to not be sent
- Errors during init doesn't throw and event for the callback HOT 4
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 cordova-plugin-background-upload.