启动时启动tizen应用程序 [英] Start tizen app at start up

查看:66
本文介绍了启动时启动tizen应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Tizen 中有一个应用程序,我想在手表启动时运行它.这是我的 app.js 的样子:

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
}

现在,我可以看到 Service Application 可以在启动时执行,此处 解释了构建服务应用程序的必要步骤.但是,我无法将这些主题与我的应用程序联系起来.如果我想在启动时启动我的应用程序,是否需要将其更改为服务应用程序?我需要做哪些改变?

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?

推荐答案

对于旧版本的 Tizen (web),我发现了一个非常非常脏的解决方法(但如果基本功能不可用,你能做什么?).

For older versions of Tizen (web) I found a very, very dirty workaround (but what can you do, if basic functionality isn't available?).

您可以发出警报(基本上是预定的应用启动)并将其设置为每 10 分钟左右启动一次您的应用.要么让您的应用一直在后台运行(通过覆盖关闭应用"手势并启用后台运行),然后就在该警报触发之前(9 分 55 秒左右),您将删除该警报并将其重置为 10 分钟.这样,您的应用程序几乎总是会运行,并且会在启动时启动.但是如果你强行关闭它(使用应用程序管理器),它可能需要 10 分钟才能再次运行.

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.

此外,您可能不希望您的应用在强行关闭 10 分钟后弹出,因此您可以使用

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

tizen.application.getCurrentApplication().getRequestedAppControl().appControl.data 

并在启动后立即隐藏应用程序(100 毫秒).该应用程序将弹出并立即再次关闭.我无法阻止这种情况发生,但这是一种在某种程度上可以接受的解决方法.

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.

这篇关于启动时启动tizen应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆