This is a migrated thread and some comments may be shown as answers.

Keep application running while screen is turned off

4 Answers 22 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
perico
Top achievements
Rank 1
perico asked on 27 Jan 2017, 04:05 PM

Hi,

I want to use a countdown in my application but when the screen turns off, it pauses after ~20 sec and resumes when the screen turns on.

Is there a way to fix it ?

Thank you.

4 Answers, 1 is accepted

Sort by
0
perico
Top achievements
Rank 1
answered on 30 Jan 2017, 01:45 PM

This plugin works properly

https://github.com/Telerik-Verified-Plugins/Insomnia

But it's not the best option.

0
Preslav
Telerik team
answered on 01 Feb 2017, 09:14 AM
Hi Perico,

Based on your post, I believe that the Cordova Background mode plugin might provide the required functionality. This plugin prevents the app from going to sleep while in the background.

Additionally, to import this plugin in an app, you will need to download it as a ZIP file from GitHub and then follow the procedure outlined here.

Regards,
Preslav
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
perico
Top achievements
Rank 1
answered on 02 Feb 2017, 08:52 AM

Hi Preslav,

Thank you for your post.

I've already seen this plugin but it seems that there is a problem to publish app's on the appStore  

https://github.com/katzer/cordova-plugin-background-mode/issues/122

0
Preslav
Telerik team
answered on 06 Feb 2017, 01:09 PM
Hi Perico,

You are correct. Indeed the app might get rejected from the App Store. 

Unfortunately, I was not able to find any other solution that can provide such functionality out of the box.

A possible solution in this situation might be using the pause and resume Cordova events. For example, on pause, you could save the timer in a variable. Once the resume event fires, you could calculate the time and update the countdown timer.

Additionally, you might be interested in the iOS Background Execution article.

Regards,
Preslav
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
General Discussion
Asked by
perico
Top achievements
Rank 1
Answers by
perico
Top achievements
Rank 1
Preslav
Telerik team
Share this question
or