मैं वर्तमान में आयनिक/एनजीकोर्डोवा का उपयोग कर एंड्रॉइड एप्लिकेशन बना रहा हूं। मैं पुश अधिसूचनाओं को लागू करने के बिंदु पर हूं। मैंने पुश अधिसूचनाओं को एक सेवा के रूप में लागू किया है जिसे app.run(function(){..})
चरण में इंजेक्शन दिया गया है। पंजीकरण भाग काम करता है और मुझे regid
युक्त कॉलबैक प्राप्त होता है। साथ ही, जब आवेदन सक्रिय स्थिति में होता है, तो ईवेंट उठाया जाता है और अधिसूचना प्राप्त होती है।एनजी कॉर्डोवा/आयनिक पुश नोटिफिकेशन जब पृष्ठभूमि पृष्ठभूमि में है
मेरी समस्या यह है कि जब एप्लिकेशन पृष्ठभूमि में जाता है, अधिसूचनाएं बिल्कुल प्राप्त नहीं होती हैं। मैं उम्मीद करता हूं कि ऐप नहीं चल रहा है या कुछ समान होने पर एक स्थानीय अधिसूचना उठाई जाएगी, लेकिन बिल्कुल कुछ भी नहीं होता है, जो अजीब है।
मैंने समाधान की तलाश में पिछले कुछ दिनों से वेब का पता लगाया है, लेकिन मुझे यह पता लगाने में असमर्थ रहा है कि मुझे किस तरह का संकेत मिलता है कि यह सिर्फ काम करना चाहिए। यह आदेश सूचनाएं देने के लिए में मदद करता है, मैं एक .net आवेदन के माध्यम से PushSharp उपयोग कर रहा हूँ तो
निम्नलिखित मेरे ऐप
app.factory('notificationService', ['$cordovaPush', function($cordovaPush){
var dataFactory = {};
//
// When the device is ready and this service has been plumbed in...
document.addEventListener("deviceready", function(){
console.log("initializing push notifications...");
_register();
}, false);
//
// Registers the device for push notifications...
var _register = function(){
var config = {};
if (device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos"){
// TODO: centralise this value as it can change...
config = {
senderID: "448168747432",
ecb: "onNotificationGCM"
};
}else {
// iOS
config = {
"badge":"true",
"sound":"true",
"alert":"true"
};
// Can add the following property to the config object to raise a callback with the information if need be...
// "ecb": "onNotificationRegisterAPN"
}
$cordovaPush.register(config).then(function(result){
//
// Typically returns "ok" for android and devicetoken for iOS
console.log(result);
});
};
window.onNotificationGCM = function(result){
console.log(result);
/*
I get called when the app is in the foreground, but nothing happens when the app is in the background.
*/
};
dataFactory.register = _register;
return dataFactory;
}]);
अंदर मेरे notificationService.js है। किसी भी तरह की सहायता का स्वागत किया जाएगा।
अद्यतन: मैं निम्नलिखित चौखटे/libs उपयोग कर रहा हूँ:
- आयोनिक फ्रेमवर्क 1.2.14-beta6
- Cordova 4.2.0
- PushPlugin