有没有人找到使用 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。不幸的是,现在可以通过 Gear S 上的 Web api 发送短信。这就是为什么没有关于此的文档;)
关于使用 Samsung Gear S 在 WebAPI 中发送短信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27290483/