Giter Site home page Giter Site logo

Comments (30)

ombr avatar ombr commented on August 14, 2024

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.

albertleao avatar albertleao commented on August 14, 2024

@ombr Hey! I'll be able to test this tonight and let you know.

from cordova-plugin-background-upload.

albertleao avatar albertleao commented on August 14, 2024

@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.

koczka avatar koczka commented on August 14, 2024

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.

ombr avatar ombr commented on August 14, 2024

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.

koczka avatar koczka commented on August 14, 2024

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.

ombr avatar ombr commented on August 14, 2024

I think you will need to remove your platform and plugin directory and restart a build.

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

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.

ombr avatar ombr commented on August 14, 2024

I will check on my side and get back to you when we have a new version fixing this.

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

Thank you for your time! Do you have any updates on this case?

from cordova-plugin-background-upload.

sc-nick avatar sc-nick commented on August 14, 2024

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.

koczka avatar koczka commented on August 14, 2024

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.

sc-nick avatar sc-nick commented on August 14, 2024

Does the notification appear? Pls paste your entire config.xml

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

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.

koczka avatar koczka commented on August 14, 2024

I set showNotification to true as I stated above, but then I get the original execute failed error again.

from cordova-plugin-background-upload.

sc-nick avatar sc-nick commented on August 14, 2024

Ok, so paste your upload config because I can't reproduce the error (parameters you pass into startUpload)

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

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.

sc-nick avatar sc-nick commented on August 14, 2024

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.

koczka avatar koczka commented on August 14, 2024

The uploads are working now, but I can't seem to get the event callback to fire.

from cordova-plugin-background-upload.

sc-nick avatar sc-nick commented on August 14, 2024

More details pls

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

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.

sc-nick avatar sc-nick commented on August 14, 2024

The event is null?

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

No, it simply doesn't get called.

from cordova-plugin-background-upload.

sc-nick avatar sc-nick commented on August 14, 2024

Could you paste your init?

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

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.

koczka avatar koczka commented on August 14, 2024

Yeah, the upload works fine, but no status updates whatsoever. It's running android 8.0.0

from cordova-plugin-background-upload.

sc-nick avatar sc-nick commented on August 14, 2024

I tested it with the same android version and it works, no error in chrome inspect?

from cordova-plugin-background-upload.

sc-nick avatar sc-nick commented on August 14, 2024

Try to init once platform is ready

this.platform.ready().then(() => { ... });

from cordova-plugin-background-upload.

koczka avatar koczka commented on August 14, 2024

No error, nor any warning. It runs after platform.ready()

from cordova-plugin-background-upload.

ombr avatar ombr commented on August 14, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.