【问题标题】:unable to send push notifications through bluemix console无法通过 bluemix 控制台发送推送通知
【发布时间】:2017-07-01 13:00:39
【问题描述】:

我已按照以下参考资料获取通知 w.r.t。安卓,

https://github.com/ibm-bluemix-mobile-services/bms-samples-cordova-hellopush 强调文字 https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push

不同的场景不工作,在这里列出, 1)当我刚刚向设备发送通知时,通过 bluemix 控制台,它会在 bluemix 控制台中显示“已发送通知”。 但过了一段时间后,我也没有在移动设备中收到通知。

我已经配置了 bluemix w.r.t。 firbease 消息传递,因此我可以从 console.firebase.com 发送通知,并且我也在设备中检索通知。

2)在设备注册期间,我没有收到成功响应回调,即使当应用程序处于后台时,我也能够在设备中获得通知。

3) 我正在尝试订阅主题,在这里我没有收到任何回复给设备,或者我无法从 bluemix 向订阅的标签发送通知,因为 bluemix 显示标签未订阅。 我在这里订阅了cordova angular js app中的标签。

如果有人对这些查询有任何建议,请告诉我。 谢谢。

【问题讨论】:

    标签: cordova ibm-mobilefirst cordova-plugins ibm-mobile-services


    【解决方案1】:

    请在此处找到 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;
    });
    

    如果有人对这些查询有任何建议,请告诉我。

    【讨论】:

      【解决方案2】:

      如果您没有收到通知,则应使用 Swagger API 验证您的设备是否已注册:

      https://mobile.ng.bluemix.net/imfpush/

      另外,请确认您已配置您的Android environment correctly

      如果您的环境设置正确,您的设备正在注册,并且您在尝试运行基本的Cordova sample 时遇到了同样的问题,那么您必须使用您的服务实例从 Bluemix 开具支持票证。这应该为支持团队提供足够的信息来解决问题。

      【讨论】:

        【解决方案3】:

        感谢您的回复, 反正我已经尝试了所有选项,但是没有从移动端收到通知回调方法。 无论如何,我已经提出了 w.r.t 的票。 bluemix 支持团队。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-19
          • 2017-08-24
          • 1970-01-01
          • 2017-11-23
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多