3
我是新流星。流星:當應用程序關閉時,推送通知:推動Android
現在我正在嘗試與科爾多瓦集成,主要是使用raix的推送通知:推送流星插件。
應用程序在後臺運行時收到簡單通知,儘管我沒有設法接收通知中的圖像。
當應用程序完全關閉時發生主要問題,因爲它無法接收通知,並且服務器不會丟失任何錯誤消息。
該應用程序部署在Heroku服務器中。
%%%%%%%%%%%%%%%%%%%%%%
% mobile-config.js %%
%%%%%%%%%%%%%%%%%%%%%%
App.configurePlugin('phonegap-plugin-push', {
SENDER_ID: XXXXXXXXXXX
});
%%%%%%%%%%%%%%%%%%
% client/main.js %
%%%%%%%%%%%%%%%%%%
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
Push.Configure({
android: {
senderID: XXXXXXXXXXX,
alert: true,
badge: true,
sound: true,
vibrate: true,
clearNotifications: true
// icon: '',
// iconColor: ''
},
});
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});
Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
});
Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
instance.counter.set(instance.counter.get() + 1);
},
});
%%%%%%%%%%%%%%%%%%
% server/main.js %
%%%%%%%%%%%%%%%%%%
import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
// code to run on server at startup
Push.Configure({
gcm: {
apiKey: 'XXXXXXXXXXXXXXXXXXXXXX',
},
production: true,
});
});
Meteor.methods({
sendPush: function() {
return Push.send({
from: 'Test',
title:'Greetings',
text:'Hello world!',
badge: 3,
query: {},
});
},
});
的mesagge在服務器外殼發送
> Meteor.call('sendPush');
我使用的下一個版本:
// [email protected]
// raix:[email protected]
// [email protected]
// [email protected]
我不明白是什麼問題,我花了很多時間試圖找到解決方案。任何幫助將受到歡迎。
面臨類似問題。你能解決它嗎? – user3807691