Newbie question on background resources

Former Member
Former Member

Hey!

Im sorry if this information already exists in the toybox API or in already made question forums!

I was just wondering how the resources work with backgrounds. I tried understanding it more studying the samples given. In BackgroundTimerBackground.mc in the backgroundTimer sample there is the function that does following:

function onTemporalEvent() {

    // Use background resources if they are available
    if (Application has :loadResource) {
        Background.requestApplicationWake(Application.loadResource(Rez.Strings.TimerExpired));
    } else {
        Background.requestApplicationWake("Your timer has expired!");
    }

    // Write to Storage, this will trigger onStorageChanged() method in foreground app
    Storage.setValue("1", 1);

    Background.exit(true);
}

So my question when studying the code, specifically "if(Application has :loadResource)"- How often does a application get the resource (So when will the if-statement hold)? For how long? Can only one application at time get the resource? Just generally how does the background "resource-system" work?


Thanks in advance! Slight smile