0

I am facing some problem in background service.I have registered the backgrond service like:var service = Ti.App.iOS.registerBackgroundService({url:'/bgservice.js'}); in bgservice.js :I actually want to check the DB(where the data execution time is>8mins) and trigger local notification.But it is not working.So tried a sample first like this,to see how much time the app is active in background:

var timer = setInterval(startsampletest, 6000);
startsampletest();
function startsampletest(){
    count=count+1;
        Ti.API.info("1.!!!!!*******startsampletest is called for"+count);
    
}

which gives me only 5 times every 6 seconds so it is executing only for 30 min(please correct me if I am wrong)But in axway documentation it says the bgservice will be active for 10 mins. Can anyone pls help me on this.I want the app to be active in background for 10 mins.pls let me know if I have made any mistakes.

Said CHAOUCHE
  • 695
  • 6
  • 17

1 Answers1

0

It is not guaranteed that a background task created by Ti.App.iOS.registerBackgroundService() will run up to 10 minutes, see: https://titaniumsdk.com/api/titanium/app/ios/backgroundservice.html#background-service-limitations

... typically to no more than 10 minutes.

But more crucial is that

The OS may terminate the background service at any point to reclaim resources.

For longer background tasks under iOS you have to use the Ti.URLSession module (com.appcelerator.urlSession).

In general, see https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_How-tos/Platform_API_Deep_Dives/iOS_API_Deep_Dives/iOS_Background_Services.html

AppsolutEinfach
  • 1,421
  • 1
  • 14
  • 25