gpt4 book ai didi

android - 如何从 meteor 调用android GCM

转载 作者:太空宇宙 更新时间:2023-11-03 13:27:38 25 4
gpt4 key购买 nike

我想在我的 android 框架中使用 Android GCM。

我看过 https://github.com/h2soft/node-gcm不过是个npm,不知道能不能用在meteor里。

感谢您的任何提示。

最佳答案

我制作了一个可以使用它的包。我还没有机会把它放在大气中。 (这是在保管箱上:https://www.dropbox.com/s/1mpwygl30deo1es/node-gcm.zip)

您可以像在 https://github.com/ToothlessGear/node-gcm 上一样使用 gcm服务器端 javascript 代码的任何位置。

例如(可以工作的简化版本)

var message = new gcm.Message();

var message = new gcm.Message({
collapseKey: 'demo',
delayWhileIdle: true,
timeToLive: 3,
data: {
key1: 'message1',
}
});

var sender = new gcm.Sender('insert Google Server API Key here');
var registrationIds = [];

registrationIds.push('regId2');

sender.send(message, registrationIds, 4, function (err, result) {
console.log(result);
});

要从客户端进行调用,您需要将其与 Meteor.call

连接

关于android - 如何从 meteor 调用android GCM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17223836/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com