How to Create Heads Up Display/Pop Up Notification?
xpnewmedia opened this issue · comments
stimulated commented
How do I ensure that the notification shows up on the screen as a Pop Up?
I've read the below docs...
documentation.onesignal.com/reference/create-notification
documentation.onesignal.com/docs/android-notification-categories
When I use the following code, notifications come through but not as Pop Up/HUD.
from onesignal_sdk.client import Client
from onesignal_sdk.error import OneSignalHTTPError
# Create a One Signal client using API KEYS.
client = Client(app_id=" ", rest_api_key=" ")
try:
notification_body = {
'headings': {"en": "Your Payment was Successful."},
'subtitle': {"en": "Order #222 is being prepared!"},
'contents': {"en": "sf"},
'include_player_ids': ['xxxxxxxxxxxxxxxxxxxxx'],
'android_channel_id': ['xxxxxxxxxxxxxxx'],
'priority': 10
}
I've tried with and without the priority, because the docs say its not needed when a channel/category is included.
When I create a notification from the OneSignal Dashboard using the same Android Category/Channel.
It comes through as a Pop Up/HUD, as intended.