Giter Site home page Giter Site logo

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent about cordova-plugin-background-upload HOT 6 OPEN

gbrits avatar gbrits commented on July 16, 2024
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

from cordova-plugin-background-upload.

Comments (6)

gbrits avatar gbrits commented on July 16, 2024

This is the output every time I try to upload, I'm using Ionic 6 in Angular. Everything works fine on iOS but not on Android :(
I have changed URLs and naming to protect the privacy of the project, but the rest of the output is exact.

It appears to schedule the background task but not fire it, it just gets enqueued. Pleeeease help.

2022-11-13 17:20:29.354 20671-20671/au.com.optix I/Capacitor/Console: File: http://192.168.0.188:8100/287.js - Line 1 - Msg: SENDING fileUri: /storage/emulated/0/Movies/Optix/ZpidoNGwGf.mp4
2022-11-13 17:20:29.355 20671-20671/au.com.optix V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 19470771, pluginId: Preferences, methodName: get
2022-11-13 17:20:29.355 20671-20671/au.com.optix V/Capacitor: callback: 19470771, pluginId: Preferences, methodName: get, methodData: {"key":"optix_user_token"}
2022-11-13 17:20:29.359 20671-20671/au.com.optix V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 19470772, pluginId: Filesystem, methodName: readFile
2022-11-13 17:20:29.359 20671-20671/au.com.optix V/Capacitor: callback: 19470772, pluginId: Filesystem, methodName: readFile, methodData: {"path":"file:\/\/\/storage\/emulated\/0\/Movies\/Optix\/ZpidoNGwGf.mp4"}
2022-11-13 17:20:29.405 20671-20671/au.com.optix V/Capacitor/Plugin: To native (Cordova plugin): callbackId: FileTransferBackground982115603, service: FileTransferBackground, action: initManager, actionArgs: []
2022-11-13 17:20:29.445 20671-20671/au.com.optix D/FileTransferBG: created FileTransfer working directory 
2022-11-13 17:20:29.448 20671-20671/au.com.optix I/Capacitor/Console: File: http://192.168.0.188:8100/287.js - Line 1 - Msg: STARTING BACKGROUND UPLOAD
2022-11-13 17:20:29.449 20671-20671/au.com.optix V/Capacitor/Plugin: To native (Cordova plugin): callbackId: FileTransferBackground982115604, service: FileTransferBackground, action: startUpload, actionArgs: [{"id":"optix_vid_a656b034-9553-319b-2b00-b4c5219c7e26","filePath":"\/storage\/emulated\/0\/Movies\/Optix\/ZpidoNGwGf.mp4","fileKey":"video_file","serverUrl":"https:\/\/portal.privateurl.com.au\/auth\/api\/videos\/upload","notificationTitle":"Optix Uploads","headers":{"Authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIyIiwianRpIjoiNjA0NzQ5Nzg2YWRlMzlmZmViMWQ1YTMxZTkyZDcyMzA4NzNlYjU4ZDM0MWFiNTkxOGYxYTBjMTQxY2UwOWU5YWQ4YjdjYWJmNjE3ZGUxZWYiLCJpYXQiOjE2NjgzMjg0NjMuNTM3NDgyLCJuYmYiOjE2NjgzMjg0NjMuNTM3NDg3LCJleHAiOjE2ODM5NjY4NjMuNTMwMjY5LCJzdWIiOiI5Iiwic2NvcGVzIjpbXX0.KDmTTvswCeHIw5YBUzNZtnekAQTeikURLNqVgEQW-zAnBrR6IvIwOmPTcRNOGLGrKHBlCVeHCqH264qpFjifCgAYliyOoGAAaexecQjOS8B3yuKhoHmRaZb73zqzVz5b_hoyqWVig15ozgjaYOA1KVTM-T57DCAE_JbRH0Z6Ch4key4K8DWBdE3NCWySR89v2KesVM4ofop-LfWmGNK_MW3wTOzrqXvW_vdSKHX1TsJ9NXS65umgF9mEvS6WmKZDU5yni0r1Kp491cpJtF3QBlBIb4d3N0w_akCLVxlmEmZO3U_fnswJ1PM9tGFAwyd6AcYoapYdvCKWCDiOshWDg7905JSde2hD2Y_mml4deFWJ8EiKkfO69cJrYsjBoT5krC6uUzVxMrETf4ArrL0EG0c3YITBxl5g8XBgmxsdL8gVV-FDVVOugmKDMoR8oolFTOEYju9DRkoETtvJl6nPwASnTYO04zglbtG1YuuSUMjXMh44UtxgiUQ5qZ9EvCy8SAEkvi6XwZm9FjVxu9nIrIH5LukjRB2P6ciXsny5vtqiI1MNhWXHDIy6DyP2foZF__ywLqLN-LVDHZa0qJFeMVXA2Oew57OdgcZrdhlo4bVlO560KK-8dimmJ8KPDS8_iErItHikhbIpRVRH9DxdiUpOmhPRHrENq6_CQV5bJbg"},"parameters":{"customer_id":"101","customer_url":"ZpidoNGwGf","filename":"ZpidoNGwGf.mp4"},"showNotification":true}]
2022-11-13 17:20:29.450 20671-20671/au.com.optix D/FileTransferBG: adding upload optix_vid_a656b034-9553-319b-2b00-b4c5219c7e26
2022-11-13 17:20:29.453 20671-20671/au.com.optix D/CompatibilityChangeReporter: Compat change id reported: 160794467; UID 10045; state: ENABLED
2022-11-13 17:20:29.453 20671-20671/au.com.optix I/Capacitor/Console: File: http://192.168.0.188:8100/287.js - Line 1 - Msg: STARTED!!!! {"_handlers":{"progress":[],"success":[],"error":[]},"options":{}}
2022-11-13 17:20:29.454 20671-20671/au.com.optix D/FileTransferBG: detected network change, Connected:true
2022-11-13 17:20:29.456 20671-20671/au.com.optix D/FileTransferBG: upload with id optix_vid_a656b034-9553-319b-2b00-b4c5219c7e26 is already exists in upload queue. ignoring re-upload request
2022-11-13 17:20:33.833 20671-21127/au.com.optix D/BufferPoolAccessor2.0: bufferpool2 0xb400007bfa396e48 : 0(0 size) total buffers - 0(0 size) used buffers - 0/6 (recycle/alloc) - 6/81 (fetch/transfer)
2022-11-13 17:20:33.834 20671-21127/au.com.optix D/BufferPoolAccessor2.0: evictor expired: 1, evicted: 1

from cordova-plugin-background-upload.

zfir avatar zfir commented on July 16, 2024

Hello @gbrits,

Can you send me your package.json, config.xml and your payload that you are sending when uploading your file.

from cordova-plugin-background-upload.

gbrits avatar gbrits commented on July 16, 2024

My config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <access origin="*" />
  <feature name="FileTransferBackground">
    <param name="ios-package" value="FileTransferBackground"/>
  </feature>
  <feature name="Camera">
    <param name="ios-package" value="CDVCamera"/>
  </feature>
  <feature name="File">
    <param name="ios-package" value="CDVFile"/>
    <param name="onload" value="true"/>
  </feature>
  <feature name="CDVOrientation">
    <param name="ios-package" value="CDVOrientation"/>
  </feature>
  <feature name="VideoEditor">
    <param name="ios-package" value="VideoEditor"/>
  </feature>
  <feature name="VideoCapturePlus">
    <param name="ios-package" value="VideoCapturePlus"/>
  </feature>
</widget>

My package.json:

{
  "name": "HiddenName",
  "version": "0.0.5",
  "author": "Hidden Author",
  "homepage": "https://hidden.author/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^14.2.10",
    "@angular/core": "^14.2.10",
    "@angular/forms": "^14.2.10",
    "@angular/platform-browser": "^14.2.10",
    "@angular/platform-browser-dynamic": "^14.2.10",
    "@angular/router": "^14.2.10",
    "@awesome-cordova-plugins/background-upload": "^6.2.0",
    "@awesome-cordova-plugins/core": "^6.2.0",
    "@awesome-cordova-plugins/file": "^6.2.0",
    "@awesome-cordova-plugins/video-editor": "^6.2.0",
    "@capacitor-community/camera-preview": "4.0.0",
    "@capacitor/android": "4.4.0",
    "@capacitor/core": "^4.4.0",
    "@capacitor/dialog": "^4.0.1",
    "@capacitor/filesystem": "^4.1.3",
    "@capacitor/ios": "^4.4.0",
    "@capacitor/preferences": "^4.0.1",
    "@capacitor/status-bar": "^4.0.1",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/file-transfer": "^5.36.0",
    "@ionic-native/ionic-webview": "^5.36.0",
    "@ionic-native/screen-orientation": "^5.36.0",
    "@ionic-native/splash-screen": "^5.36.0",
    "@ionic-native/video-capture-plus": "^5.36.0",
    "@ionic-native/video-editor": "^5.36.0",
    "@ionic/angular": "^6.3.6",
    "chart.js": "^2.9.4",
    "cordova-plugin-androidx": "^3.0.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-background-upload": "^1.1.0",
    "cordova-plugin-camera": "^6.0.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-file": "^7.0.0",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-screen-orientation": "^3.0.2",
    "cordova-plugin-video-editor": "^1.1.3",
    "date-fns": "^2.28.0",
    "es6-promise-plugin": "^4.2.2",
    "guid-typescript": "^1.0.9",
    "jszip": "^3.10.0",
    "mxms-vid-capture": "^0.0.4",
    "nanoid": "^3.3.4",
    "ng2-search-filter": "^0.5.1",
    "root-require": "^0.3.1",
    "rxjs": "^6.5.5",
    "tslib": "^2.1.0",
    "tus-js-client": "^2.2.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.9",
    "@angular/cli": "^10.0.5",
    "@angular/compiler": "^14.2.10",
    "@angular/compiler-cli": "^14.2.10",
    "@angular/language-service": "^14.2.10",
    "@capacitor/cli": "^4.4.0",
    "@ionic/angular-toolkit": "^2.3.0",
    "@types/jasmine": "^4.0.3",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "^17.0.36",
    "codelyzer": "^6.0.2",
    "jasmine-core": "~4.1.1",
    "jasmine-spec-reporter": "~7.0.0",
    "jetifier": "^2.0.0",
    "karma": "~6.3.20",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.0.1",
    "karma-jasmine-html-reporter": "^2.0.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "^4.8.4"
  },
  "description": "An Ionic project"
}

The payload:

2022-11-13 17:20:29.449 20671-20671/au.com.optix V/Capacitor/Plugin: To native (Cordova plugin): callbackId: FileTransferBackground982115604, service: FileTransferBackground, action: startUpload, actionArgs: [{"id":"optix_vid_a656b034-9553-319b-2b00-b4c5219c7e26","filePath":"\/storage\/emulated\/0\/Movies\/Optix\/ZpidoNGwGf.mp4","fileKey":"video_file","serverUrl":"https:\/\/portal.privateurl.com.au\/auth\/api\/videos\/upload","notificationTitle":"Optix Uploads","headers":{"Authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIyIiwianRpIjoiNjA0NzQ5Nzg2YWRlMzlmZmViMWQ1YTMxZTkyZDcyMzA4NzNlYjU4ZDM0MWFiNTkxOGYxYTBjMTQxY2UwOWU5YWQ4YjdjYWJmNjE3ZGUxZWYiLCJpYXQiOjE2NjgzMjg0NjMuNTM3NDgyLCJuYmYiOjE2NjgzMjg0NjMuNTM3NDg3LCJleHAiOjE2ODM5NjY4NjMuNTMwMjY5LCJzdWIiOiI5Iiwic2NvcGVzIjpbXX0.KDmTTvswCeHIw5YBUzNZtnekAQTeikURLNqVgEQW-zAnBrR6IvIwOmPTcRNOGLGrKHBlCVeHCqH264qpFjifCgAYliyOoGAAaexecQjOS8B3yuKhoHmRaZb73zqzVz5b_hoyqWVig15ozgjaYOA1KVTM-T57DCAE_JbRH0Z6Ch4key4K8DWBdE3NCWySR89v2KesVM4ofop-LfWmGNK_MW3wTOzrqXvW_vdSKHX1TsJ9NXS65umgF9mEvS6WmKZDU5yni0r1Kp491cpJtF3QBlBIb4d3N0w_akCLVxlmEmZO3U_fnswJ1PM9tGFAwyd6AcYoapYdvCKWCDiOshWDg7905JSde2hD2Y_mml4deFWJ8EiKkfO69cJrYsjBoT5krC6uUzVxMrETf4ArrL0EG0c3YITBxl5g8XBgmxsdL8gVV-FDVVOugmKDMoR8oolFTOEYju9DRkoETtvJl6nPwASnTYO04zglbtG1YuuSUMjXMh44UtxgiUQ5qZ9EvCy8SAEkvi6XwZm9FjVxu9nIrIH5LukjRB2P6ciXsny5vtqiI1MNhWXHDIy6DyP2foZF__ywLqLN-LVDHZa0qJFeMVXA2Oew57OdgcZrdhlo4bVlO560KK-8dimmJ8KPDS8_iErItHikhbIpRVRH9DxdiUpOmhPRHrENq6_CQV5bJbg"},"parameters":{"customer_id":"101","customer_url":"ZpidoNGwGf","filename":"ZpidoNGwGf.mp4"},"showNotification":true}]

from cordova-plugin-background-upload.

gbrits avatar gbrits commented on July 16, 2024

Ok so since upgrading to Angular 11.0 and updating a bunch of the toolkits as a result, I'm now getting the unable to find file error when trying to upload. Never been so happy to see an error!

I also think I was using cordova-plugin-background-upload and had to delete that, to use this library.

  • Attempting to upload via fileUri from a transcoder. Will update here with the fix for that.

Updated package.json:

"dependencies": {
    "@angular/common": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@awesome-cordova-plugins/background-mode": "^6.2.0",
    "@awesome-cordova-plugins/background-upload": "^6.2.0",
    "@awesome-cordova-plugins/core": "^6.2.0",
    "@awesome-cordova-plugins/file": "^6.2.0",
    "@awesome-cordova-plugins/video-editor": "^6.2.0",
    "@capacitor-community/camera-preview": "4.0.0",
    "@capacitor/android": "4.5.0",
    "@capacitor/core": "^4.4.0",
    "@capacitor/dialog": "^4.0.1",
    "@capacitor/filesystem": "^4.1.3",
    "@capacitor/ios": "^4.4.0",
    "@capacitor/preferences": "^4.0.1",
    "@capacitor/status-bar": "^4.0.1",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/file-transfer": "^5.36.0",
    "@ionic-native/ionic-webview": "^5.36.0",
    "@ionic-native/screen-orientation": "^5.36.0",
    "@ionic-native/splash-screen": "^5.36.0",
    "@ionic-native/video-capture-plus": "^5.36.0",
    "@ionic-native/video-editor": "^5.36.0",
    "@ionic/angular": "^6.3.6",
    "@spoonconsulting/cordova-plugin-background-upload": "^4.0.7",
    "chart.js": "^2.9.4",
    "cordova-plugin-androidx": "^3.0.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-camera": "^6.0.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-file": "^7.0.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-ns0m-file-transfer": "^2.0.0-7",
    "cordova-plugin-screen-orientation": "^3.0.2",
    "cordova-plugin-video-editor": "^1.1.3",
    "date-fns": "^2.28.0",
    "es6-promise-plugin": "^4.2.2",
    "guid-typescript": "^1.0.9",
    "jszip": "^3.10.0",
    "mxms-vid-capture": "^0.0.4",
    "nanoid": "^3.3.4",
    "ng2-search-filter": "^0.5.1",
    "root-require": "^0.3.1",
    "rxjs": "^6.5.5",
    "tslib": "^2.0.0",
    "tus-js-client": "^2.2.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.0",
    "@angular/cli": "^11.2.19",
    "@angular/compiler": "^15.0.0",
    "@angular/compiler-cli": "^15.0.0",
    "@angular/language-service": "^15.0.0",
    "@capacitor/cli": "^4.4.0",
    "@ionic/angular-toolkit": "^7.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "^17.0.36",
    "codelyzer": "^6.0.0",
    "jasmine-core": "^4.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "jetifier": "^2.0.0",
    "karma": "~6.3.20",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "^5.1.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "^4.8.4"
  },

from cordova-plugin-background-upload.

gbrits avatar gbrits commented on July 16, 2024

The URI that is failing to upload:

FileURI:

/storage/emulated/0/Android/data/au.com.private-url/files/files/videos/-O6RLl1L2S.mp4

EDIT:
Adding 'file://' and permissions hasn't changed this yet:

"file:\/\/\/storage\/emulated\/0\/Android\/data\/au.com.private-url\/files\/files\/videos\/sZBz7kUc2Z.mp4"
2022-11-17 13:11:03.364 32701-1367/au.com.private-url E/CordovaBackgroundUpload: doWork: File not found !
    java.io.FileNotFoundException: /__cdvfile_files-external__/files/videos/sZBz7kUc2Z.mp4: open failed: ENOENT (No such file or directory)

The plugin I am using (cordova-plugin-video-editor) uses the following java code to generate the path:

mediaStorageDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + cordova.getActivity().getPackageName() + "/files/files/videos");

from cordova-plugin-background-upload.

zfir avatar zfir commented on July 16, 2024

Hello @gbrits,

I am seeing in your package.json that you are using not the latest version: 4.0.7

Make sure to include the installation like this in you package.json:

"@spoonconsulting/cordova-plugin-background-upload": "4.0.7"

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.