# sendSMS()
发送短信
示例
this.$app
.sendSMS({
phoneNum: '18380000000',
message: '19970805'
})
.then(res => {
console.log('app/sendSMS====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 说明 |
---|---|---|
data | object | 推送消息参数 |
data参数说明:
参数名 | 类型 | 说明 |
---|---|---|
phoneNum | String | 手机号 |
message | String | 短信内容 |
# createMessage()
创建本地消息
示例
this.$app
.createMessage({
content: '您好,本地推送内容',
payload: '',
notificationId: '100000000',
options: {
delay: 10,
sound: 'system',
title: '推送标题',
subtitle: '推送副标题'
}
})
.then(res => {
console.log('app/createMessage====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | object | 是 | 推送消息参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
content | String | 是 | 消息显示的内容,在系统通知中心中显示的文本内容。 |
payload | String | 可选 | 消息承载的数据,可根据业务逻辑自定义json数据格式。 |
options | Object{MessageOptions} | 是 | 创建消息的额外参数 |
notificationId | String | 是 | 本地消息id(Android 忽略此参数,因为android支持覆盖消息需要自动生成notificationId,会在createMessage后返回消息的notificationId,执行remove方法的id就可以使用返回的notificaitionId) |
options参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
delay | Number | 是 | 提示消息延迟显示的时间 |
appid | String | 可选 | 要启动流应用的appid,仅在流应用环境中有效,默认值为当前流应用的appid。 iOS - ALL (不支持): 不支持覆盖消息,只能创建新的消息。 |
cover | Boolean | 可选 | 是否覆盖上一次提示的消息 。iOS - ALL (不支持): 不支持覆盖消息,只能创建新的消息。 |
icon | String | 可选 | 推送消息的图标。 iOS - ALL (不支持): 不支持自定义图片,固定使用应用图标。icon设置的是通知栏的大图标,通知栏的小图标不支持。 |
sound | String | 可选 | 推送消息的提示音。显示消息时的播放的提示音,可取值:“system”表示使用系统通知提示音; “none”表示不使用提示音;默认值为“system”。 |
title | String | 可选 | 推送消息的标题。在系统消息中心显示的通知消息标题,默认值为程序的名称。 |
subtitle | String | 可选 | 推送消息的副标题。 |
when | Number | 可选 | 消息上显示的提示时间,android接收时间戳,以long的类型传递下来,默认为当前时间。iOS不支持,不支持设定消息的显示时间,由系统自动管理消息的创建时间 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
result | Boolean | true成功,false失败 |
notificationId | String | Android特有字段,Android会在创建本地消息后返回创建消息的id,用户需要自己维护 |
# getAllMessage()
获取所有消息
示例
this.$app.getAllMessage().then(res => {
console.log('app/getAllMessage====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
title | String | 推送消息显示的标题 |
content | String | 推送消息显示的内容 |
notificationId | String | 消息的id |
payload | Object{MessegeBody} | 推送消息承载的数据 |
返回MessegeBody参数说明:
参数名 | 类型 | 说明 |
---|---|---|
key1 | String | 额外参数1 |
key2 | String | 额外参数2 |
key3 | String | 额外参数3 |
# removeMessage()
删除指定消息
示例
this.$app.removeMessage('1176272163').then(res => {
console.log('app/removeMessage====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
msgId | String | 是 | 本地消息id |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
result | Boolean | 删除结果 |
# clearMessage()
清除通知中心的消息
示例
this.$app.clearMessage().then(res => {
console.log('app/clearMessage====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
result | Boolean | 清除结果 |
# getClientInfo()
获取客户端推送标识信息
示例
this.$app.getClientInfo().then(res => {
console.log('app/getClientInfo====', JSON.stringify(res));
});
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
systemName | String | 系统名称,如iOS,Android |
id | String | 推送通道标识,如JSPush,Getui |
token | String | ios设备令牌(iOS设备唯一标识,用于APNS服务推送中标识设备的身份),安卓不支持 |
clientid | String | 推送平台设备唯一标识(视情况而定,没有唯一标识的推送平台不返回clientid) |
appid | String | 推送平台服务的应用标识 |
appkey | String | 推送平台服务器的应用键值 |
# setAutoNotification()
设置程序是否将消息显示在系统消息中心,IOS设备不支持此API.
示例
this.$app.setAutoNotification(true).then(res => {
console.log('app/setAutoNotification====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
isNotify | Boolean | 是 | 否将消息显示在系统消息中心 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
result | Boolean | 操作结果 |
notificationId | string | 消息的ID |
# setAlias()
绑定别名,通过别名指定推送到设备 (iOS不支持)
示例
this.$app.setAlias({ alias: '1234' }).then(res => {
console.log('app/setAlias====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | object | 是 | 设置别名参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
alias | string | 激光否 个推是 | 设置的别名 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object | 调用结果信息 |
# deleteAlias()
删除别名 (iOS不支持)
示例
this.$app.deleteAlias({ alias: '1234' }).then(res => {
console.log('app/deleteAlias====', JSON.stringify(res));
});
入参说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | object | 激光否 个推是 | 删除别名参数 |
data参数说明:
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
alias | string | 激光否 个推是 | 待删除的别名 激光推送不需要,个推必传 |
success 返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
res | object | 调用结果信息 |