Languages

Menu
Sites
Language
Application launch by alarm causes screen activation
Hello
 
I have a problem while using the Alarm API and Application Control. I set a recurring alarm which periodically activates my app:
 
var appId = tizen.application.getCurrentApplication().appInfo.id;
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/default", "myUri");
var newAlarm = new tizen.AlarmRelative(60, 600); //after 60 seconds, every 10 minutes
tizen.alarm.add(newAlarm, appId, appControl);
 
 
This in general works OK, my app is activated periodically. However, for some reason, every time my app is activated, the screen of the watch is turned on. 
 
In other words, my app needs to do some work every 10 minutes, without user interaction, so it doesn't need to be visible, but the operating system activates the screen anyway. It causes bad user experience, because the user just sees the screen flash randomly now and then. It doesn't help if I turn off the screen programatically ( tizen.power.turnScreenOff() ), because it is too late, the screen is already active for at least 1 second, showing the watchface.
 
I have tried using different app control operations: default, main, view, even custom ones, but it doesn't help.
 
To make things more interesting, this only happens on Tizen 3 (Gear S3 watch). On the Gear S2, the screen is not activated.
 
Could someone shed some light on this issue? Is it normal? Is it a feature that when launching the app by using Alarm API and Application Control, the screen will always be turned on?
 
If yes, how can I periodically launch my app in the background, without activating the screen?
 
Thank you

Responses

8 Replies
GEUNSOO KIM

did you ever set "background-support" and "background-category" in your config.xml?

for example, like there lines

<tizen:background-category value="sensor"/>

<tizen:setting background-support="enable" encryption="disable" hwkey-event="enable"/>

you can find them on "Tizen" tab on your config.xml editor.

And when you test it, you'd better use the operations other than 'default'. usually 'main' or your custom one.

good luck.

Armaan-Ul- Islam

Hello Maciej,

What's your current state? Seems there's no response from your side.

As far as I know,  Setting 'http://tizen.org/appcontrol/operation/main'  instead of 'default' should do the trick.

 

In addition, You may also check out this question on Stack Overflow. The issue is not exact similar of yours but thanks to tymbark ,you can grab some useful hints from the question.

https://stackoverflow.com/questions/49752776/is-it-possible-to-keep-tizen-application-alive-non-stop

Maciej

 

Hello. Thanks for the suggestions. Unfortunately I haven't been able to fix this issue. My very simplistic code:

 

        //schedule alarm
        var appId = tizen.application.getCurrentApplication().appInfo.id;
        var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/main");
        var newAlarm = new tizen.AlarmRelative(240, 300); 
        tizen.alarm.add(newAlarm, appId, appControl);
        
        tizen.power.turnScreenOff();
        tizen.application.getCurrentApplication().exit();

 

I have also added the mentioned parameters in the config.xml:

    <tizen:setting background-support="enable" encryption="disable" hwkey-event="enable"/>
    <tizen:background-category value="sensor"/>

 

Using the "main" operation doesn't help. After 4 minutes (240 seconds), the screen is activated on the watch and then the UI of my app is shown. 

It happens only on Tizen 3 (Gear S3, probably Gear Sport too). It does not happen on Gear S2 (screen stays dark, although the app is launched).

Could anybody explain why there is such a difference? It ruins the concept of my app. Also, I think it doesn't make sense to let the app work in background (background-category), if the screen is activated anyway. 

Can somebody suggest a solution for this problem?

Armaan-Ul- Islam

"Could anybody explain why there is such a difference?" 

 

Your Gear S2 is running on Tizen 2.3.X with having no Issues on this matter.

Gear S3/Sport is running on Tizen 3.0 having Issue cause-> turnScreenOff() trick is not working.

 

The reason:

tizen.power.turnScreenOff() has got deprecated from Tizen 3.0. Tizen OS don't want the developers to turn screen on/off programmatically anymore. It means tizen.power.turnScreenOff() function won't turn the screen off for you.

Maciej

@Armaan-Ul- Islam: thanks for your answer, but I am afraid you are wrong.

First of all, it doesn't have anything to do with the Power API and turnScrennOff/On() calls. The problem happens when the app is woken up by the alarm, not when I schedule the alarm and exit the app (and turn off the screen, although it doesn't actually matter). After several minutes, the app is woken up and the screen is activated. There is no code related to turning the screen on or off manually.

Secondly, the Power API and turnScrennOff/On() calls might be deprecated in Tizen 3, but they work. When some API or method is deprecated, it means it will probably stop working in the future. Now it still works.

So I am still looking for some solutions...

GEUNSOO KIM

Well.. then try this. create a service app and put the alarm app control on this service app id.

if this works for you, you can use it by re-designing your app as consisting of UI and service app.

Otherwise.. well I think there is no more solution I can think right now.

Maciej

​Hello. Yes, I am treating a service component as a last solution in this case, because it would needs quite a lot of redesign. By the way, do you mean a native service or web service?

Armaan-Ul- Islam

You have to go for Native Service application.

Web Service Application is only for TV app development with partner-level certification.

 

This Tip & Tech Document Shares one way of how to establish communication between Web UI app and Native Service app, You may check it out.

Sending Bundle over Message Port