【发布时间】:2014-12-05 18:09:16
【问题描述】:
有没有人找到使用 WebAPI 将应用程序中的 SMS 集成到 Samsung Gear S 的工作示例?
我找到了 tizen 的两个示例,但没有一个与 Gear S 一起使用。稍作修改后,它们看起来像这样:
第一次尝试:
function sendSMS(smsno)
{
if (bDebug)
alert("Versuche SMS (sendSMS) zu senden an " + smsno);
smsnumber = smsno;
try
{
var appControl = new tizen.ApplicationControl(
'http://tizen.org/appcontrol/operation/compose', 'sms:'
+ smsnumber);
tizen.application.launchAppControl(appControl, null, function()
{
}, function(e)
{
alert("SMS konnte nicht gesendet werden: " + e.message);
},
{
onsuccess : function()
{
},
onfailure : function(er)
{
alert("SMS konnte nicht gesendet werden: " + er.message);
}
});
}
catch (e)
{
alert("http://tizen.org/appcontrol/operation - " + e.message);
}
}
第二次尝试:
// Define the success callback.
function messageSent(recipients)
{
if (bDebug)
alert("The SMS has been sent");
}
// Define the error callback.
function messageFailed(error)
{
alert("The SMS could not be sent " + error.message);
}
// Define service error callback.
function serviceErrorCB(error)
{
alert("Cannot get messaging service " + error.message);
}
// Define the success callback.
function serviceListCB(services)
{
try
{
if (services.length > 0)
{
var msg = new tizen.Message("messaging.sms",
{
plainBody : "Hilferuf von Nummer: " + smsnumber + ": "
+ vorname + " " + nachname + ": " + adresse,
to : [ smsnumber ]
});
// Send request
services[0].sendMessage(msg, messageSent, messageFailed);
}
}
catch (e)
{
alert("serviceListCB Problem - " + e.message);
}
}
function sendSMS_tizen(smsno)
{
if (bDebug)
alert("Versuche SMS zu senden an " + smsno);
smsnumber = smsno;
try
{
tizen.messaging.getMessageServices("messaging.sms", serviceListCB,
serviceErrorCB);
}
catch (e)
{
alert("tizen.messaging nicht definiert- " + e.message);
}
}
不幸的是,三星文档在这方面非常不具体。
欢迎任何想法!
【问题讨论】:
-
在 Gear S 中可以发现 com.samsung.message.appcontrol.compose 已定义(使用 tizen.application.getAppsInfo(onListInstalledApps); 检查。但没有可用的文档如何使用它. 有人知道这个功能吗?