I have an app in Tizen, and I would like to run it at the watch's boot up. Here is how my app.js
looks like:
$(document).ready(function() {
document.addEventListener('tizenhwkey', function(e) {
if(e.keyName == "back") {
tizen.application.getCurrentApplication().exit();
}
});
// The rest of the program
}
Now, I can see that a Service Application can be executed at the start up, and here explains what are the necessary steps to build a Service Application. However, I was not able to relate these topics to my application. If I want to have my application started at the boot up, do I need to change it to a Service Application? What are the changes I need to do?
Yes, you can. If You understood the main point about web service app tht it will not hv an UI.
To convert web app to web service app, you need to append your config.xml file with below code
Final look of config.xml will be like this
And add following privilege
This link provides complete method to be followed to create a web service application.
https://developer.tizen.org/dev-guide/wearable/2.3.0/org.tizen.wearable.web.appprogramming/html/tutorials/service_tutorial/service_app_tutorial.htm
For older versions of Tizen (web) I found a very, very dirty workaround (but what can you do, if basic functionality isn't available?).
You can make an alarm (basically a scheduled app-start) and set it up to start your app every 10 minutes or so. Either you have your app run in the background all the time (by overriding the "close app"-gesture and enabling run-in-background) and just before that alarm would fire (9 mins 55 seconds or so), you'd remove that alarm and reset it to 10 minutes. That way, your App will almost always run and it will be started at boot. But if you close it forcefully (with the app manager), it might take 10 minutes until it's running again.
Also, you might not want your app to pop open 10 minutes after you forcefully closed it, so you can read out the start parameters with
and hide the app immediately (100ms) after launching it. The app will pop up and immediately close again. I couldn't keep that from happening, but it's a workaround that works somewhat acceptably.