我正在按照本教程https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-android-push-notification-google-gcm-get-started处理带有Google Cloud Messaging的本机和天蓝推送通知服务的推送通知,该应用程序在添加链接中的所有配置和代码后没有显示任何错误,构建成功但现在我该怎么办在我的手机上发送推送通知?假设我是loggen in用户,我希望这个特定用户收到一些通知,我该怎么做?我是否需要在某处注册我的设备ID,如果是,我在哪里首先获得它,如何生成?

我的代码如下所示:

const NotificationHub = require('react-native-azurenotificationhub');

const connectionString ='...'; // Notification Hub连接字符串const hubName ='...'; //通知中心名称const senderID ='xxxx'; // Firebase控制台的 Cloud 消息传递选项卡中的发件人ID const tags = []; //要订阅的标记集

register() {
    console.warn("register called....");
    NotificationHub.register({connectionString, hubName, senderID, tags})
        .catch(reason => console.warn(reason));
}

unregister() {
    NotificationHub.unregister()
        .catch(reason => console.warn(reason));
}

这两种方法注册和取消注册的时间是什么?它们何时被调用,执行?我只是不知道如何做到这一点,以便我可以收到来自我的反应原生移动应用程序的通知,这是一个独立的项目来自世博会!