【问题标题】:Accessing B2B APIs and Web APIs in React for Tizen Applications在 React for Tizen 应用程序中访问 B2B API 和 Web API
【发布时间】:2022-09-27 19:41:17
【问题描述】:

我正在尝试创建一个在基于 Tizen OS 的设备上运行的 React 应用程序。而且我需要使用 B2B API 和 Web API 来打印和获取设备信息。

提供的所有指南都在 Tizen Studio 中使用了 Web App 模式,但没有提及如何在 React 中使用库。

索引.html

<script type=\'text/javascript\' src=\'$B2BAPIS/b2bapis/b2bapis.js\'></script>
<script type=\"text/javascript\" src=\"$WEBAPIS/webapis/webapis.js\"></script>

配置.xml:

<tizen:privilege name=\"http://developer.samsung.com/privilege/serialport\"/>
<tizen:privilege name=\"http://developer.samsung.com/privilege/productinfo\"/>

指南已经提到在 index.html 和 config.xml 文件中添加上述内容。但我不认为我们可以通过上述方法在 React 应用程序中使用该库。

如何访问这两个用于 React 的 API Javascript 库?

    标签: tizen tizen-web-app tizen-studio


    【解决方案1】:

    Tizen Web 应用程序需要特定的结构,包括 config.xml 文件,包括权限和其他设置。我认为您需要围绕您的 React 应用程序创建 Tizen 包装器应用程序,以使其在 Tizen 上运行。

    我不熟悉 React,但如果你已经有 React 应用程序,我会这样做:

    1. 创建空的 Tizen Web 应用程序
    2. 将 React 应用程序的源代码放入 Tizen 应用程序模板。
      • 修改 config.xml 文件入口点以使用 React 应用程序的 index.html
      • 使用一些基于 js 的重定向,例如正如this answer 中所建议的那样
    3. 使用 Tizen Studio 构建、安装和运行应用程序。

      我认为此时该应用程序应该可以在 Tizen 上运行。

      然后您应该能够轻松地应用您提到的 config.xml 和 index.html 并在您的应用程序中使用 Tizen API。

    【讨论】:

    • 你能验证 3. b.你的答案部分?我不清楚这一点。
    猜你喜欢
    • 2016-06-18
    • 1970-01-01
    • 2020-12-21
    • 2017-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-29
    相关资源
    最近更新 更多