Reputation: 43
I have followed the following references for notifications w.r.t. android,
https://github.com/ibm-bluemix-mobile-services/bms-samples-cordova-hellopush emphasized text https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push
different scenarios not working, are listed out here, 1)through bluemix console when ever i just send notifications to device, it shows "notification sent for delivery" in the bluemix console. but after sometime also i am not getting notifications in the mobile device.
i have configured bluemix w.r.t. firbease messaging & so i am able to send notifications from console.firebase.com, & paralley i am retrieving notifications in device too.
2)during device registration time, success response callback i am not getting, even though when app, is in background i am able to get notifications in device.
3)i am trying to subscribe to topic, here i am not getting any response back to device, either i am unable to send notifications to subscribed tags from bluemix, since bluemix shows tags are not subscribed. i have subscribed to tag in cordova angular js app here.
let me know if anybody have any suggestions on these queries. thanks.
Upvotes: 1
Views: 84
Reputation: 43
Please find js file here.
var ocMobile=angular.module("ocMobile",[]);
ocMobile.factory("ocMobileFactory",function(/*global parameters */){
var ocMobileFactory={
initialize: function() {
this.bindEvents();
growl.info("B4 initialize");
// some codebase
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
document.addEventListener('offline', this.onOffline, false);
document.addEventListener('resume', this.onResume, false);
},
onOffline: function() {
// somecodebase
},
onResume: function() {
// some codebase
},
onDeviceReady: function() {
console.log("omnichannel onDeviceReady");
growl.info("onDeviceReady");
this.registerNotifications();
},
registerNotifications: function() {
growl.info("registerNotifications");
BMSClient.initialize(BMSClient.REGION_US_SOUTH);
// iOS Actionable notification options. Eg : {"category_Name":[{"identifier_name_1":"action_Name_1"},{"identifier_name_2":"action_Name_2"}]}
// Pass empty for Android
var category = {};
//device returns platform , deviceid etc., parameters
if (device.platform.toLowerCase() === "ios"){
category = {"category_Name":[{"identifier_name_1":"action_Name_1"},{"identifier_name_2":"action_Name_2"}]};
}
growl.info("registerNotifications: category:"+category);
BMSPush.initialize(appGuid parameter, clientSecret parameter, category);
var success = function(successResponse) {
// success handler display successresponse msg with token...
//TODO once successcallback register for topic subscriptions & test it
var successTag = function(successResponse) {
console.log("topic subscribed response:"+successResponse);
growl.info("topic subscribed response:"+successResponse);
};
var failureTag = function(failureResponse) {
console.log("topic subscription failed due to :"+failureResponse);
growl.info("topic subscription failed due to :"+failureResponse);
};
var tag = "YourTag";
BMSPush.subscribe(tag, successTag, failureTag);
};
var failure = function(failureResponse) {
//failure handler display failure reason with failureresponse
};
var options = {"userId": "Your User Id value"};
BMSPush.registerDevice(options, success, failure);
var handleNotificationCallback = function(notification) {
alert(notification.message);
}
BMSPush.registerNotificationsCallback(handleNotificationCallback);
}
}
return ocMobileFactory;
});
Let me know if anybody have any suggestions on these queries.
Upvotes: 0
Reputation: 43
thanks for reply, anyway i have tried all the options, but there is no notification callback method received from mobile end. anyway i have raised ticket w.r.t. bluemix support team.
Upvotes: 0
Reputation: 2488
If you are not getting notifications, you should verify that your device is registered by using the Swagger API:
https://mobile.ng.bluemix.net/imfpush/
In addition, please verify that you have configured your Android environment correctly.
If your environment is set correctly, your device is being registered, and you have the same issues when attempting to run the basic Cordova sample, you will have to open up a support ticket from Bluemix with your service instance. That should give the support team enough information to solve the issue.
Upvotes: 0