【发布时间】:2015-07-16 11:31:52
【问题描述】:
在 Google Developers Console 中注册适用于 Android 的 Google Cloud Messaging
我们获取 API 密钥
使用 SenderID(项目编号)和 GCM API 密钥更新 lib/app.js
使用 meteor run android-device 启动您的应用
-
当 Android App 上的 Start app 崩溃时:
ReferenceError: 通知客户端未定义
请帮帮我。
/*****************************************************************************/
/* Client App Namespace */
/*****************************************************************************/
_.extend(App, {
});
App.helpers = {
showForm: function() {
return (Meteor.user() && !Meteor.isCordova);
}
};
_.each(App.helpers, function (helper, key) {
Handlebars.registerHelper(key, helper);
});
Template.form.events({
'click [data-action="send-notification"], submit': function (event, template) {
event.preventDefault();
Meteor.call('notify', template.$('[data-field="title"]').val(), template.$('[data-field="message"]').val(), function(err, res) {
if (err) {
console.log(err);
} else {
if (res.userCount) {
alert('Notification sent.');
}
}
});
}
});
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY'
});
【问题讨论】:
标签: android meteor google-cloud-messaging