@byteowls/capacitor-sms

中文文档
7.0.0发布于 2025/07/23MITTypeScriptCommonJS零依赖近 30 天下载 6814

Capacitor SMS plugin

原始使用文档
文档目录9 节
  1. SMS
  2. Installation
  3. Versions
  4. Configuration
  5. Error Codes
  6. Contribute
  7. Changelog
  8. License
  9. Disclaimer


SMS

@byteowls/capacitor-sms

Capacitor SMS plugin


Capacitor SMS plugin

Plugin for sending short messages using the device's SMS app.

Installation

npm i @byteowls/capacitor-sms
npx cap sync

Versions

PluginFor CapacitorDocsNotes
7.x7.x.xREADMEBreaking changes see Changelog.
6.x6.x.xREADMEBreaking changes see Changelog.

Configuration

import {Component, OnInit} from '@angular/core';
import {SmsManager} from "@byteowls/capacitor-sms";


@Component({
    template: "<button mat-raised-button color='primary' (click)='sendSms()'>Send SMS now!</button>"
})
export class SmsExampleComponent implements OnInit {

    async ngOnInit() {
        const info: DeviceInfo = await Device.getInfo();
    }

    sendSms() {
        const numbers: string[] = ["+43 123 123123123", "+43 4564 56456456"];
        SmsManager.send({
            numbers: numbers,
            text: "This is a example SMS",
        }).then(() => {
            // success
        }).catch(error => {
            console.error(error);
        });
    }
}

Error Codes

  • SEND_CANCELLED ... User cancelled or closed the SMS app.
  • ERR_SEND_FAILED ... The SMS app returned that sending the message to the recipients failed. (ios only)
  • ERR_SEND_UNKNOWN_STATE ... The SMS app returned a unknown state. There is nothing I can do to clarify the error. (ios only)
  • UNIMPLEMENTED ... Sending SMS on the web is not supported.
  • ERR_NO_NUMBERS ... No recipient numbers were retrieved from options. Make sure to deliver only valid numbers, because the whole sending will fail.
  • ERR_NO_TEXT ... No message text was retrieved from options.
  • ERR_SERVICE_NOTFOUND ... The used device can not send SMS.

Contribute

See Contribution Guidelines.

Changelog

See CHANGELOG.

License

MIT. Please see LICENSE.

Disclaimer

We have no business relation to Ionic.

版本与发布记录

@byteowls/capacitor-sms 共发布 29 个版本,首次发布于 2018/11/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.0.0latest2025/07/231.3 年前
6.0.02024/07/262 年前
5.0.02023/09/043 年前
4.0.02022/09/184 年前
3.0.22022/05/034 年前
3.0.12022/04/134 年前

关于 @byteowls/capacitor-sms 的常见问题

@byteowls/capacitor-sms 是什么?

Capacitor SMS plugin

如何安装 @byteowls/capacitor-sms?

在项目目录运行 npm install @byteowls/capacitor-sms,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=7.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@byteowls/capacitor-sms 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@byteowls/capacitor-sms 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@byteowls/capacitor-sms 可以商用吗?

@byteowls/capacitor-sms 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@byteowls/capacitor-sms 的下载量有多少?

根据 npm 官方下载统计,@byteowls/capacitor-sms 在 2026/10/09 – 2026/11/07 这 30 天内被下载 6,814 次,日均约 227 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@byteowls/capacitor-sms 还在维护吗?

最新版本 7.0.0 发布于 2025/07/23(1.3 年前);至今共发布 29 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/11/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。