react-native-background-upload
react-native-background-upload copied to clipboard
can i send custom messages? before and during the upload
hello friends is there any possibility to use this component to display custom messages in the notifications before and during the upload process? example.. will you be able to?
if ((filextns == "mp4") || (filextns == "3gp") || (filextns == "mkv") || (filextns == "avi") || (filextns == "mov")) {
const nombVideo = idx + "_" + "file_temp.mp4"
const newpatch = pictureFolder + "/" + nombVideo
let file = newpatch;
if (Platform.OS == "android") {
file = newpatch.replace("file://", "");
}
//Here, show a notification message
//Upload.notfication('Starting the file conversion 1 of 3');
Upload.startUpload({
url: this.hostconex + 'publicacion.php?f=regimultmediapost',
path: file,
method: 'POST',
field: "file",
type: "multipart",
parameters: {
'usuario': FuncGlobal.idusuario,
'postid': idpost.toString(),
'filewidth': i.width.toString(),
'fileheight': i.height.toString()
},
maxRetries: 2, // set retry count (Android only). Default 2
headers: {
'content-type': 'multipart/form-data', // Customize content-type
'Accept': 'application/json'
},
notification: {
enabled: true,
//autoClear: false,
notificationChannel: 'UploadMedia',
},
useUtf8Charset: true
}).then((uploadId) => {
Upload.addListener('progress', uploadId, (data) => {
console.log(`Progress: ${data.progress}%`)
})
Upload.addListener('error', uploadId, (data) => {
console.log(`Error: ${data.error}%`)
})
Upload.addListener('cancelled', uploadId, (data) => {
console.log(`Cancelled!`)
})
Upload.addListener('completed', uploadId, (data) => {
console.log('Completed!')
//Here, show a notification message
//Upload.notfication('Upload Complete 1 of 3');
})
}).catch((err) => {
console.log('Upload error!', err)
})
}