Php 推送器api通知在android Emulator和浏览器上不起作用

Php 推送器api通知在android Emulator和浏览器上不起作用,php,android,pusher,Php,Android,Pusher,我正在使用Pusher API进行通知,但它是为我工作的。我在我的网站上有combobox,它部署在azure上,在这个combobox中有三个状态,当用户在combobox中更改状态时,它会显示pending complete requesttimeout,所以ajax请求将发送到json文件,我在其中添加了通道和事件绑定 我还在emulator上收到消息 10-12 12:13:15.544: D/CordovaLog(1257): file:///android_asset/www/ind

我正在使用Pusher API进行通知,但它是为我工作的。我在我的网站上有combobox,它部署在azure上,在这个combobox中有三个状态,当用户在combobox中更改状态时,它会显示pending complete requesttimeout,所以ajax请求将发送到json文件,我在其中添加了通道和事件绑定

我还在emulator上收到消息

10-12 12:13:15.544: D/CordovaLog(1257): file:///android_asset/www/index.html: Line 28 : Pusher : State changed : unavailable -> connected
10-12 12:13:15.544: I/Web Console(1257): Pusher : State changed : unavailable -> connected at file:///android_asset/www/index.html:28
10-12 12:13:15.553: D/CordovaLog(1257): file:///android_asset/www/index.html: Line 28 : Pusher : Event sent : {"event":"pusher:subscribe","data":{"channel":"dispatcher_channel"}}
10-12 12:13:15.553: I/Web Console(1257): Pusher : Event sent : {"event":"pusher:subscribe","data":{"channel":"dispatcher_channel"}} at file:///android_asset/www/index.html:28
10-12 12:13:17.613: D/CordovaLog(1257): file:///android_asset/www/index.html: Line 28 : Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"dispatcher_channel"}
10-12 12:13:17.613: I/Web Console(1257): Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"dispatcher_channel"} at file:///android_asset/www/index.html:28
10-12 12:13:17.623: D/CordovaLog(1257): file:///android_asset/www/index.html: Line 28 : Pusher : No callbacks on dispatcher_channel for pusher:subscription_succeeded
10-12 12:13:17.623: I/Web Console(1257): Pusher : No callbacks on dispatcher_channel for pusher:subscription_succeeded at file:///android_asset/www/index.html:28
json.php这是在azure上的

function updateRequestStatus($params)
    {
        global $api;

        $params = json_decode($params, true);

        $requestStatus = PageHelper::sanitizeInput($params['requestStatus'], FILTER_SANITIZE_STRING);
        $requestID = PageHelper::sanitizeInput($params['requestID'], FILTER_SANITIZE_NUMBER_INT);

        if(strtolower($requestStatus) == "completed")
        {
            $message = "User Response Has been Sent ";
            $pusher = new Pusher( APP_KEY, APP_SECRET, APP_ID );
            $data = array('message' => $message);
            $pusher->trigger( 'dispatcher_channel', 'dispatcher_Response', $data );
        }

        return $api->updateRequestStatus($requestStatus, $requestID);
    }
还有我在android上使用的index.html

<!DOCTYPE HTML>
<html>
<head>
<title></title>

<meta name="viewport" content="width=device-width,initial-scale=1"/>

<!--  JavaScript -->


<script src="http://js.pusher.com/2.1/pusher.min.js" type="text/javascript"></script>
<script src="js/cordova.js" type="text/javascript"></script>

<script type="text/javascript">
    // Enable pusher logging - don't include this in production
    Pusher.log = function(message) {
      if (window.console && window.console.log) {
        window.console.log(message);
      }
    };

    var pusher = new Pusher('APP_KEY');
    var channel = pusher.subscribe('dispatcher_channel');
    channel.bind('notification', function(data) {
    setTimeout('getNotification()', 1000);
    channel.bind('dispatcher_Response', function(data) {}); 
    }); 
    function getNotification()
    {
        navigator.notification.alert("status changed", function() {});
    }
  </script>

</head>
</body>
</html>

//启用推送器日志记录-不要将其包括在生产中
Pusher.log=功能(消息){
if(window.console&&window.console.log){
window.console.log(消息);
}
};
var推进器=新推进器(“应用程序键”);
var channel=pusher.subscribe('dispatcher_channel');
channel.bind('notification',函数(数据){
setTimeout('getNotification()',1000);
bind('dispatcher_Response',function(data){});
}); 
函数getNotification()
{
navigator.notification.alert(“状态已更改”,function(){});
}

日志显示您已连接并订阅了
dispatcher\u频道
频道

运行
json.php
时,Pusher调试控制台显示什么?见:

它是否显示来自
json.php
到达推送器的消息

如果没有,那么您应该查看PHP代码的调试。见:


如上所述,客户端功能似乎正常工作。

你能告诉我为什么通知不会弹出吗?因为我在android emulator的cat日志上查看了它,它向我显示了消息,消息即将出现,但不会在上面的代码中的模拟器上弹出(
channel.bind('dispatcher_Response',function(data){};
)您没有对事件数据执行任何操作。