question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ionic 2: need to display real time progress indicator in notification

See original GitHub issue

Hi,

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:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
umasdaicommented, May 10, 2017

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.

0reactions
rwillettcommented, May 10, 2017

It has come up before.

We have issues with Ionic and loading indicators and gave up. They never worked for us.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-progress-bar - Ionic Framework
ion -progress-bars are horizontal loading indicators that inform users about the status of ongoing app processes—such as submitting a form or saving updates....
Read more >
Angular 2 real time progress bar - Stack Overflow
When you start to get data, you can display your progress bar and subscribe on the progressEventObservable observable.
Read more >
How to Display Ionic 4 Local Notifications (Schedule, Payload ...
Join my special Ionic School today: https://ionicacademy.com/Video Courses, Project Templates, Community & the Support you deserve to learn ...
Read more >
Displaying Progress in a Notification | Android Developers - MIT
Notifications can include an animated progress indicator that shows users the status of an ongoing operation. If you can estimate how long the...
Read more >
Progress indicator - Carbon Design System
A progress indicator is a visual representation of a user's progress through a set of steps, guiding toward the completion of a specified ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found