【问题标题】:android azure push notification to another userandroid azure 推送通知给另一个用户
【发布时间】:2015-09-04 09:10:40
【问题描述】:

我将消息插入数据库 azure。 在消息中有from_id 和to_id。 这个to_id如何推送到哪个?

function insert(item, user, request) {

request.execute({success:sendPush});

push.gcm.send(null, item.message, {
            success:function(response) {
        console.log('Push notification sent: ', response);
    },error:
    function(error) {
        console.log('Error sending push notification: ', error);
    }
    });
}

【问题讨论】:

    标签: android azure notifications push


    【解决方案1】:

    push.gcm.send 方法的第一个参数带有一个或多个“标签”。标签唯一标识一个设备或一组设备,在您的情况下,是设备的 _id。目前它为空,因此消息将发送到所有注册的设备。

    请注意,在您的 Android 代码 onRegistered 事件中,每台设备在注册到 GCM 时都需要提供其唯一 ID,如下所示:

    ToDoActivity.mClient.getPush().register(gcmRegistrationID, new String[]{ "theDeviceID" } );
    

    【讨论】:

      猜你喜欢
      • 2022-08-18
      • 1970-01-01
      • 1970-01-01
      • 2019-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-17
      • 1970-01-01
      相关资源
      最近更新 更多