在三星智能电视上显示警报

Showing Alert on samsung smart TV

本文关键字:显示 电视 三星 智能      更新时间:2023-09-26

我正在研究三星智能电视上的tizen应用程序,当我使用window.alert()创建警报时,它可以在模拟器上工作,但在电视上。

代码如下:

mac = webapis.network.getMac();
console.log(mac);
window.alert(mac);

有解决方案吗?

当您使用Tizen网络API时,请在config.xml文件中为Tizen应用程序添加internet访问权限。Internet特权允许应用程序访问Internet。

<tizen:privilege name="tizen.org/privilege/internet"/>
<tizen:privilege name="http://developer.samsung.com/privilege/network.public"/>

也定义外部访问策略可能需要访问网络。根据W3C Access Requests Policy (WARP),默认情况下不能访问外部网络资源。如果您需要访问外部网络资源,您必须使用config.xml文件中的Policy请求Web应用程序的网络资源权限。

<access origin="*" subdomains="true"/>

现在你的应用程序应该能够从真实设备中访问MAC地址,就像模拟器一样,你应该能够从电视设备中警报MAC地址。

直接使用:alert(mac);而不是:window.alert(mac);

我想是因为你没有权限调用函数getMac()因此mac=null和alert(mac)不显示任何内容。

谢谢。