0

使用 nodejs node-apn,我可以发送通知,但我找不到任何有关将图像添加到通知的文档

    const apnProvider = new apn.Provider(options);

    const note = new apn.Notification();

    note.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.
    note.badge = 10;
    note.sound = "default";
    //note.sound = "ping.aiff";
    note.priority = 10;
    note.contentAvailable = true;//this field required. otherwise notification callback fired only on notification click
    note.pushType = "background";
    note.body = body;
    note.title = title;
    // note.image = "https://icons.iconarchive.com/icons/uiconstock/e-commerce/48/e-commerce-icon-icon.png"//notification.image
    note.payload = dataObj;
    note.topic = "org.HHHHHHH";
    try {
        apnProvider.send(note, deviceToken).then((result) => {
            console.log(JSON.stringify(result));
        });
    } catch (e) {

请帮忙

4

0 回答 0