How to prevent go my app OnSleep / OR / How to keep sensors active when OnSleep?


I am solving my biggest problem. I create app that measure heart beat from tizen.sensor. You can set the range, for example from 50 - 120 and if your BPM is below or above this range - display alert (and other functions) appear. This works perfectly, when you look at this app and it is active on screen. Problem started, when you dont look on watch and they go “sleep” (black screen). Sensors are down in this state. So I cant measure.

Question is - is there any option to block app going to sleep? OR is there any option to keep sensors alive? I am googling all day this problem and still dont find any simply solution for this.

Additional question - If we figure it out, how to keep sensors alive (app still goes on background) - is it possible, that if BPM is over / below my setted range - this function can open my app so user see it?

The Device OEM and the Operating System have the goal to ensure effective usage of the device resources. It will restrict the constant usage of the device resources to optimize power consumption and to prevent the device components from being heated up. As an application developer, we have to face these system restrictions and make the best possible out of them.

I would recommend you to check out this public post as this discusses many prospects. These topics may discuss Native or Web API, but there exists some alternative API / features for .NET also.

Is it possible to keep Tizen application alive non stop - Stack Overflow
++ How can I read sensor data when the display is off? | Tizen Developers

For example, you may try a package of a UI app with a service app. The UI app will launch the service app. The service app running in the background will read sensor data. While reading sensor data from the background, if the data crosses the 50~120 boundary it will launch the UI app for further operations.

In addition, the system will kill the service app running in the background for a long period. You have to take some additional measurements here. You can use the Alarm API to re-launch the service application from both your service application & UI application from time to time. The minimum interval for launching has to be 10 minutes or above.

And also use the background category (sensor) in your app manifest. Ensure you’re using the proper Sensor PausePolicy, interval, listeners,etc. Might also use the device Power/Resource request APIs, but remember that will cause system warning pop-ups.

Relevant resources:
Device Sensors | Tizen Docs
Namespace Tizen.Sensor (
Alarms | Tizen Docs
Class Alarm (
Class Power (

That’s all I can share from my experience, hope this helps.

1 Like

Thank you s.a.f.w.a.n, this help me a lot :slight_smile: And I also found this:
Workout, a Tizen Sample App: Gathering Heart Rate Data - Samsung Developer Forum - Samsung Tizen Forum where this was my line what I am looking for:

PausePolicy = SensorPausePolicy.None
1 Like