@triniwiz/nativescript-messenger
SMS 插件,适用于您的 NativeScript 应用
npm i --save @triniwiz/nativescript-messenger

@triniwiz/nativescript-messenger

npm install @triniwiz/nativescript-messenger

使用方法

方法

send:向一个或多个接收者发送消息

参数
  • numbers:电话号码字符串数组。支持单个或多个。可选
  • message:消息正文。可选
  • subject:主题消息。可选
  • media:附件切换消息到 MMS,支持 png、jpeg、mp4 可选
import {send, available} from "@triniwiz/nativescript-messenger";
const numbers = ["868-657-1234", "868-630-4321", "868-648-1122"];
send(numbers, "My message", "Subject of Message", [
{
fileName: 'destiny_2.jpg',
mimeType: 'image/jpg',
path: '~/assets/destiny_2.jpg',
}
]);

此方法也返回一个 promise。可以使用以下方式在用户取消或发送消息后定义操作。

    send(["868-555-5555", "868-555-4444"], "this is body").then(function(args){
console.log(args.response);
// either a string saying cancelled or sent
console.log(args.message);
// just a string with more detail than response.

/* you can do stuff here.. this happens back
in your app after the message window has
been dismissed */

}, function (e) {
console.log("Error occurred " + e);
// e will show a vague error message.
});

许可证

Apache 许可证第 2 版