Time.deltaTime not running in background (for local notification)

I’m trying to make an app that sends a local notification to the user after some time.

I tried with time.deltatime:

            var startTime = 0.0;
            var tempo1 = 50.0;
            function Start()
                    var notif = new LocalNotification();
                    notif.alertBody = "Che ora è?";
                function Update()
                    startTime += Time.deltaTime;
                    if (startTime >= tempo1) {
                      Debug.Log ("About to play aiff.");

                      var notif = new LocalNotification(); 
                      notif.alertAction = "alert";
                      notif.alertBody = "Playing aiff sound";
                      notif.applicationIconBadgeNumber = -1;
                      notif.soundName = notif.defaultSoundName;

but it seems that the time is not passing while the app is in background

do you have any suggestions?
thanks in advance

You can use OnApplicationPause and OnApplicationFocus and deal there with time that has passed whilst on background

If an app is not in the foreground, it doesn’t run. Only services can run in the background. Your app is freezed while not active. If you want to schedule a notification you should set the fireDate to a point in the future. You can’t run your own logic in the background. A Unity-app is a foreground application.

To run something in the background you would need to create a service which isn’t possible with Unity. On Android you would need to create this in Java (not UnityScript or Javascript, the real Java) and for iOS you probably need to do this in Objective C in xcode.

However this has nothing to do with Unity and is device specific.