nativescript-local-notifications icon indicating copy to clipboard operation
nativescript-local-notifications copied to clipboard

set progress on ongoing notification "Android"

Open bhavincb opened this issue 6 years ago • 6 comments

how to set progress of ongoing notification on android?

bhavincb avatar Apr 02 '18 09:04 bhavincb

Can you elaborate?

EddyVerbruggen avatar Apr 02 '18 09:04 EddyVerbruggen

LocalNotifications.schedule([{
    id: 1,
    title: 'The title',
    body: 'Recurs every minute until cancelled',
    ticker: 'The ticker',
    ongoing: true, // makes the notification ongoing (Android only)
    at: new Date(new Date().getTime() + (10 * 1000)) // 10 seconds from now
  }]).then(
      function() {
        console.log("Notification scheduled");
      },
      function(error) {
        console.log("scheduling error: " + error);
      }
  )

above code creates on going notification on android. it will show a progress bar in notification. how to set progress value for that notification.

bhavincb avatar Apr 02 '18 11:04 bhavincb

I wasn't aware you could set the progress value - can you do me a favor and point me at the SDK call that's needed? Or some SO answer perhaps.

EddyVerbruggen avatar Apr 02 '18 12:04 EddyVerbruggen

i will clone the repo and make necessary changes to it.

bhavincb avatar Apr 02 '18 12:04 bhavincb

@bhavincb did you manage to find a solution?

shivgolani avatar Jun 09 '18 05:06 shivgolani

Didn't have time to completely implement it in local-notification so created small plugin. here you can use it: https://www.npmjs.com/package/nativescript-progress-notifications

bhavincb avatar Jun 09 '18 17:06 bhavincb