首页 > SAP > HANA > SMP3.0学习笔记之十八 实现GCM的消息推送
2019
08-27

SMP3.0学习笔记之十八 实现GCM的消息推送

SMP3.0可以实现对iOS、BB、Android和WP移动设备的消息推送。这里以Android的Google Cloud
Messaging为例说明SMP3.0的消息推送机制。

首先对SMP
Application的Android GCM进行配置:

<img src="/oldimg/50/https://www.ut163.com/wp-content/uploads/2019/08/20190827124510-38.jpg" alt="SMP3.0学习笔记之十八实现GCM的消息推送” />

API Key和Sender ID可以从Google获取。

在自己的Kapsel项目里增加Kapsel push Plugin:

cd C:\Kapsel_Projects\MyPushExcercise

cordova -d platform add android

cordova -d plugin add
C:\SAP\MobileSDK3\KapselSDK\plugins\push

在代码中注册GCM客户端:

registerForPush : function() {

//TODO: Add push registration code

var nTypes = sap.Push.notificationType.SOUNDS |
sap.Push.notificationType.ALERT;

sap.Push.registerForNotificationTypes(nTypes,

this.registerForPushSuccess,

this.registerForPushFailure,

this.proccessNotification,

“xxxxxx);
//GCM Sender ID, null for APNS

},

移动成功Logon之后,使用Postman通过SMP向客户端发送GCM消息:

URL:

<img src="/oldimg/50/https://www.ut163.com/wp-content/uploads/2019/08/20190827124510-45.jpg" alt="SMP3.0学习笔记之十八实现GCM的消息推送” />

消息发送后,系统终端收到如下消息并显示:

<img src="/oldimg/50/https://www.ut163.com/wp-content/uploads/2019/08/20190827124510-3.jpg" alt="SMP3.0学习笔记之十八实现GCM的消息推送” />

最后编辑:
作者:yangsen
本站为个人博客网站,全由我个人维护,我从事SAP开发13年,其它ERP开发7年,基本都是零售行业。本站记录工作学习的过程, 有SAP相关询问专、兼职工作可随时联系我。 有网站相关的问题可直接在文章下方留言,或者联系我。 邮件:yan252@163.com给我。 QQ:415402519

留下一个回复

你的email不会被公开。