Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Displaying a running timer in the notification bar when app goes to the background mode

$
0
0

@Niranjan100395 wrote:

I have used the following plugin to run the app in the background.
Background plugin from katzer

I have to run a timer in the notification bar continuously when the app goes in the background (just to show how long the app is in the background).

cordova.plugins.backgroundMode.setDefaults({
title : 'Timer running',
text : 'some text'
});

cordova.plugins.backgroundMode.onactivate = function () {
setInterval(function () {
a=a+1;
cordova.plugins.backgroundMode.configure({
text: a
});
}, 1000);
}

I have initialized a to 0 when the app is launched. The code is working and the text part of the notification is getting updated.
But each time it is updated a new notification is created. Is there a possible way to update just the text part of the notification without creating a new notification each time?

Thanks in advance

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>