Ionic 2: need to display real time progress indicator in notification
See original GitHub issueHi,
I’m new to ionic 2 and i’m using file transfer plugin https://ionicframework.com/docs/native/transfer/ to upload a file in my project. Whenever i’m uploading a file there will be percentage indicator showing the file upload progress. Do you guys have any idea how I want to replicate this in the notification?
Your Environment
- Plugin version: Latest version
- Platform: android
- OS version: Windows 7
- Device manufacturer / model: Standard Android Devices (Generic)
- Cordova version (
cordova -v
): 6.5.0 - Cordova platform version (
cordova platform ls
): - Plugin config
Expected Behavior
I need the notification to keep updating whenever the progress percentage increases until the upload completed to 100%
Actual Behavior
I tried and it only take some of the number and displays only that only updates when the upload completes. It doesnt updates in real time with the progress.
Steps to Reproduce
onProgress = (progressEvent: ProgressEvent) : void => { this.ngZone.run(() => { if (progressEvent.lengthComputable) { let progress = Math.round((progressEvent.loaded / progressEvent.total) * 100); this.uploadNotification(progress); } }); }
public uploadFile() { this.onGoing(); this.fileTransfer.onProgress(this.onProgress); this.fileTransfer.upload(path, url,options).then((result) => { this.localNoti.completeNoti(); },(err) => {
}) }
onGoing(){
let notification = {
id: 1,
title: 'File Transfer App!',
text: 'Upload Start',
at: this.now,
};
this.localNotifications.schedule(notification);
}
uploadNotification(fileName){
let notification = {
id: 1,
title: 'File Transfer App!',
text: 'Uploading: ' + fileName + '%'
};
this.localNotifications.update(notification);
}
completeNotification(){
let notification = {
id: 1,
title: 'File Transfer App!',
text: 'Upload complete!',
};
this.localNotifications.update(notification);
}
Context
The onProgress() function will keep updating the value when a file is being uploaded, so I want the value updates the respectively with the notifications showing the upload progress.
Debug logs
No debug logs
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top GitHub Comments
Really?? Well that’s a bit disappointing. Still, I’ll try to search for any other solution that might display a bit of the progress.
Thanks.
It has come up before.
We have issues with Ionic and loading indicators and gave up. They never worked for us.