Привет Я следую инструкциям нижеандроид push-уведомление в телефоне не получает уведомления
1) Я создал структуру проекта cordova.
2) Я добавил платформу (android).
3) Я добавил плагин Cordova
cordova plugin add https://github.com/phonegap-build/PushPlugin.git#2.4.0
4) Bulid проект Cordova.
5) Затем я импортировать созданное приложение в андроид затмения (4.4.2)
6) Я написал следующий код в файл index.js
init: function(){
alert("init");
var pushNotification = window.plugins.pushNotification;
pushNotification.register(successHandler, errorHandler,
{
'senderID':'XXXXXXXXXX',
'ecb':'onNotificationGCM' // callback function
}
);
function successHandler(result) {
console.log('Success: '+ result);
alert(result);
}
function errorHandler(error) {
console.log('Error: '+ error);
}
function onNotificationGCM(e) {
alert("comming");
if('registered' === e.event) {
// Successfully registered device.
}
else if('error' === e.event) {
// Failed to register device.
}
};
Я получаю откос, как «КИ» й я не в состоянии вызова «ECB»: onNotificationGCM»// функция обратного вызова
В Android консоли я получаю сильфона сообщения
V/PushPlugin(2512): execute: action=register
V/PushPlugin(2512): execute: data= [{"senderID":"889953963751","ecb":"onNotificationGCM"}] V/PushPlugin(2512): execute: jo={"senderID":"889953963751","ecb":"onNotificationGCM"} V/PushPlugin(2512): execute: ECB=onNotificationGCM senderID=889953963751
09-12 03:13:33.453: D/GCMRegistrar(2512): resetting backoff for com.ensis.hello
09-12 03:13:33.613: V/GCMRegistrar(2512): Registering app com.ensis.hello of senders 889953963751
09-12 W/PluginManager(2512): THREAD WARNING: exec() call to PushPlugin.register blocked the main thread for 181ms. Plugin should use CordovaInterface.getThreadPool().
Вы зарегистрированы в GCM? –
Да, я зарегистрировал – malli
, вы получили регистрационный номер GCM? –