Skip to content

通讯模块:打电话、发短信(含:Android、iOS)

License

Notifications You must be signed in to change notification settings

aipaw/eeui-plugin-communication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

通讯模块

安装

eeui plugin install https://github.com/aipaw/eeui-plugin-communication

卸载

eeui plugin uninstall https://github.com/aipaw/eeui-plugin-communication

引用

const communication = app.requireModule("eeui/communication");

call(to, callback) 拨打电话

参数

  1. to (String)

  2. [callback] (Function)

示例

communication.call('415-736-0000')
communication.call('415-736-0000', () => {
    console.log('called')
})

mail(to, options, callback) 发送邮件

参数

  1. to (String | Array)

  2. [options] (Object)

    • subject (String)

    • body (String)

  3. [callback] (Function)

示例

communication.mail('hi@natjs.com')
communication.mail(['hi@natjs.com', 'dev@natjs.com'], {
    subject: 'Subject',
    body: 'content goes here'
}, () => {
    console.log('email popup')
})

sms(to, message, callback) 发送短信

参数

  1. to (String | Array)

  2. [message] (String)

  3. [callback] (Function)

示例

communication.sms('415-736-0000')
communication.sms(['415-736-0000', '425736-32'], 'message goes here', () => {
    console.log('sms popup')
})

Error
CALL_PHONE_PERMISSION_DENIED
SEND_SMS_PERMISSION_DENIED
CALL_INVALID_ARGUMENT
SMS_INVALID_ARGUMENT
MAIL_INVALID_ARGUMENT