onesignal-node icon indicating copy to clipboard operation
onesignal-node copied to clipboard

iOS Critical Notifications

Open jeremywj opened this issue 2 years ago • 0 comments
trafficstars

If I use the onesignal "Send message" GUI form on the website I can get a critical alert on my test phone just fine. This tells me my app is fine. However, through the API with this plugin I can't get critical notifications to work. See code below. The notification with the code below will come through if I turn DND off. However, with DND I get nothing even though I should.

const notification = new OneSignal.Notification(); notification.app_id = ONESIGNAL_APP_ID; notification.include_player_ids = [pushId]; notification.include_player_ids = [pushId]; notification.priority = 10; notification.ios_interruption_level = "critical"; notification.mutable_content = true; notification.data = { type: "test" } notification.android_channel_id = getAudioTag(sound).android;

notification.ios_sound = getAudioTag(sound).ios;
notification.contents = {
    en: "Test Push Notification @ " + pageGetTime((Date.now() / 1000), users.getUserData(userId).timeFormat)
};
notification.headings = {
    "en": "Test"
}

jeremywj avatar Apr 28 '23 02:04 jeremywj