【问题标题】:Trouble in Integarating Push Notification with Meteor(Android)将推送通知与 Meteor (Android) 集成时遇到问题
【发布时间】:2015-07-16 11:31:52
【问题描述】:
  1. 在 Google Developers Console 中注册适用于 Android 的 Google Cloud Messaging

  2. 我们获取 API 密钥

  3. meteor-cordova-notifications

  4. 使用 SenderID(项目编号)和 GCM API 密钥更新 lib/app.js

  5. 使用 meteor run android-device 启动您的应用

  6. 当 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


    【解决方案1】:

    您忘记添加包本身。

    meteor add richsilv:cordova-notifications
    

    【讨论】:

      猜你喜欢
      • 2016-02-06
      • 2017-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-28
      • 1970-01-01
      • 2017-08-12
      • 1970-01-01
      相关资源
      最近更新 更多