如何为我的智能手表打包 Tizen Web Widget 和 Tizen Web 应用程序?

How do I package a Tizen Web Widget with a Tizen Web Application for my smartwatch?

我创建了一个 Web Widget,我想将其推送到我的手表。 Tizen Documenation says a widget cannot be deployed standalone. So, I am trying to bundle my Widget with a Web Application. I have successfully pushed the Web Application to my watch, but I can't get the widget to go with it. I tried following the steps here: https://developer.tizen.org/development/getting-started/web-application/application-development-process#multi

我的 Web Widget 叫做 JohnDoeWidget。我将其捆绑在一起的 Web 应用程序称为 BuddyUI(这是示例应用程序)。在 Tizen IDE 中,在 Project Explorer 中显示 "JohnDoeWidget [With BuddyUI] wearable-2.3.2"。所以我认为我正确地完成了那部分。但是,当我将 BuddyUI 推送到我的 phone 时,没有小部件。

在 BuddyUI config.xml 中,在 Tizen(或高级)菜单中,Web Widget 部分没有任何内容。 这肯定是问题所在! 但是,我不知道如何向其中添加 JohnDoeWidget。我尝试手动编辑 config.xml 文件,但是当它构建时,它显示 "JohnDoeWidget exists with a different web widget project."。 BuddyUI config.xml 看起来像这样

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="(removing link)" xmlns:tizen="(removing link)" id="(removing link)" version="1.0.0" viewmodes="maximized">
    <tizen:application id="yUnJzQvDKJ.BuddyUI" package="yUnJzQvDKJ" required_version="2.3"/>
    <content src="index.html"/>
    <feature name="(removing link)/feature/screen.size.normal"/>
    <icon src="icon.png"/>
    <name>BuddyUI</name>
    <tizen:privilege name=(removing link)/privilege/application.launch"/>
    <tizen:profile name="wearable"/>
    <tizen:setting hwkey-event="enable"/>
</widget>

我试着把它改成这个,但没有成功。

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="(removing link)" xmlns:tizen="(removing link)" id="(removing link)" version="1.0.0" viewmodes="maximized">
    <tizen:application id="yUnJzQvDKJ.BuddyUI" package="yUnJzQvDKJ" required_version="2.3"/>
    <content src="index.html"/>
    <feature name="(removing link)/feature/screen.size.normal"/>
    <icon src="icon.png"/>
    <name>BuddyUI</name>
    <tizen:privilege name="(removing link)/privilege/application.launch"/>
    <tizen:profile name="wearable"/>
    <tizen:setting hwkey-event="enable"/>
    <tizen:app-widget id="Fttrlmw6YQ.JohnDoeWidget.JohnDoeWidget" primary="true">
        <tizen:widget-label>Hello Web Widget!</tizen:widget-label>
        <tizen:widget-content src="index.html">
            <tizen:widget-size preview="preview.png">2x2</tizen:widget-size>
        </tizen:widget-content>
    </tizen:app-widget>
</widget>

我也尝试将应用程序小部件 ID 更改为 yUnJzQvDKJ.BuddyUI.JohnDoeWidget,但这给出了错误 "JohnDoeWidget exists with a different web widget project."。

如何向现有 Web 应用程序添加小部件?

-- 编辑: 我还尝试了以下方法:

Gear S2 不支持 Web 小部件。 (我不能确定 S3。)
看看这个document.

从 2.3.2 开始支持 Web 小部件。但是齿轮 s2 是 2.3.1.

我不知道你的智能手表是什么,但我知道每个三星智能手表都有 OS 在 tizen 2.3.1 下。

我在 Tizen Studio 最新版本的 2.3.2 模拟器中检查了我的解决方案。 并确保它可以在模拟器上运行。
但它不适用于我的三星 gear s2。

所以这是正确的操作 "web widget" 当前没有在真实目标上工作。


不要编辑 config.xml 以添加小部件。

link 中检查用于在包中添加项目的小部件后,Tizen Studio 将 config.xml 更改为添加小部件。
你可以在解压后看到它 BuddyUI.wgt

您的错误似乎是因为小部件标签重复。
我认为在你构建后自动生成 config.xml 可能有两个相同的 app-widget 标签。

只需执行以下过程并构建 UI 项目。

In the Web UI application project context menu, select Properties > Tizen Studio > Package > Multi.
Select the check box for the web widget applications, and click OK.

大家可以去看看Tizen studio是怎么做的。只需解压 wgt 文件即可。

我创建了基本的 UI 和 TestWidget1 并将其与上层进程合并为一个 wgt 文件。解压缩后显示以下文件树。

├── author-signature.xml
├── config.xml
├── css
│   └── style.css
├── icon.png
├── index.html
├── js
│   └── main.js
├── signature1.xml
└── widget
    └── TestWidget1
        ├── css
        │   └── style.css
        ├── icon.png
        ├── index.html
        ├── js
        │   └── main.js
        └── preview.png

还有以下config.xml

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="http://yourdomain/BasicUI2" version="1.0.0" viewmodes="maximized">
    <tizen:app-widget id="LRVQWwNeO1.BasicUI2.TestWidget1" primary="true">
        <tizen:widget-label>Hello Web Widget!</tizen:widget-label>
        <tizen:widget-content src="widget/TestWidget1/index.html">
            <tizen:widget-size preview="widget/TestWidget1/preview.png">2x2</tizen:widget-size>
        </tizen:widget-content>
    </tizen:app-widget>
    <tizen:application id="LRVQWwNeO1.BasicUI2" package="LRVQWwNeO1" required_version="2.3.2"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.all"/>
    <icon src="icon.png"/>
    <name>BasicUI2</name>
    <tizen:profile name="wearable"/>
</widget>