請在這裏找到js文件。
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;
});
讓我知道是否有人對這些查詢有任何建議。