Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed near end of progress #179

Open
Tioecomp opened this issue Feb 10, 2022 · 5 comments
Open

Failed near end of progress #179

Tioecomp opened this issue Feb 10, 2022 · 5 comments

Comments

@Tioecomp
Copy link

Tioecomp commented Feb 10, 2022

I'm trying to use this plugin to send two types of files a .txt and a sqlite.db from my android device, the .txt file uploaded sucessfully but the database keeps failing at´94%.
my debug:
uploading: Database progress: 0% uploading: Database progress: 15% uploading: Database progress: 40% uploading: Database progress: 94% upload: Database has failed

my code:
`var uploader = window.util.UPLOADER;

	var payload = {
		"id": 'Database',
		"filePath": dbFilePath,
		"fileKey": "db",
		"serverUrl": window.util.BASE_URL + 'log-upload',
		"headers": {
			"content-type": "application/octet-stream"
		},
		"parameters": {
			"idUsuario": window.util.USER_ID.toString(),
			"idAparelho": device.uuid
		}
	};		
	uploader.startUpload(payload);`

And If I try to send again the process dont start.

@dinitri
Copy link
Member

dinitri commented Feb 10, 2022

Hi @Tioecomp ,
make sure you init the uploader like this:

declare var FileTransferManager: any;
var config = {};
var uploader = FileTransferManager.init(config, callback);

please also make sure you are using the @spoonconsulting/cordova-plugin-background-upload: 2.0.7 in your package.json

@Tioecomp
Copy link
Author

How can i install the v2.0.7? I tried cordova plugin add cordova-plugin-background-upload@2.0.7 but thats not the right way. I keep getting the 1.1.0 version.

@Tioecomp
Copy link
Author

I tried this: cordova plugin add @spoonconsulting/cordova-plugin-background-upload and i get this error.
Failed to install '@spoonconsulting/cordova-plugin-background-upload': Error: @spoonconsulting/cordova-plugin-background-upload cannot be added. <edit-config> changes in this plugin conflicts with <edit-config> changes in config.xml. Conflicts must be resolved before plugin can be added.

@Tioecomp
Copy link
Author

I manage to install the plugin at least it shows at package.json but i'm getting FileTransferManager is not defined after deviceready and I was not getting this error with the version 1.1.0

@zfir
Copy link
Member

zfir commented Feb 11, 2022

Hello @Tioecomp,

Do you have this line in the file where you are using FileTransferManager:

declare var FileTransferManager: any;

If not, try to add it and build again.

Regards,
Zafir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants