Notifications about the system events when the app closed or minimized

[V2.2] You can set up receipt of notifications when iRidium minimized on iOS. This "Local" background notifications works from 2 to 19 minutes, so we do not recomend to use it to inform about important events.

When the app cloased, you cannot get a notification at all


How to setup:


var in_BG = false;

IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("DRIVER"), function(name, value)
{
if(name == 'STATUS' && in_BG)
{
// Sound identifiers
SOUND_ID = {
None : 0, // without sound
Default : 1, // standard notification sound on iOS
Ringing : 2, // standard ringtone
}
// Creation of required variables
string = "DRIVER " + name + " VALUE = " + value;
id = "" + name;
delay = 0; // seconds
sound_id = SOUND_ID.Default;
// badge – the numeric icon on the app icon
badge_increment_num = 1;
IR.SendNotification(string, delay, sound_id, badge_increment_num, id);
}
});

// when the application goes to the background
IR.AddListener(IR.EVENT_APP_ENTER_BACKGROUND, 0, function()
{
in_BG = true;
});

// when the application comes to the foreground
IR.AddListener(IR.EVENT_APP_ENTER_FOREGROUND, 0, function()
{
in_BG = false;
});


This article was helpful for 1 person. Is this article helpful for you?