OneSignal

OneSignal offers a feature-rich push notification service suitable for startups to enterprise-level apps.

  • Send push notifications to individual devices, groups of devices, or all devices at once.
  • Send push notifications via the OneSignal.com dashboard, or programmatically through their API.
  • Optionally specify a targetUrl to open within your app when the notification is clicked.
  • Support for custom notification sounds, badging, collapsing notifications, and more.

πŸ‘

Developer Demo

Display our demo page in your app to test during development https://median.dev/onesignal/

Median offers an official OneSignal integration allowing you to easily integrate iOS and Android native push notifications into your app.

Our documentation provides a comprehensive guide to the Median↔️ OneSignal integration. You can also refer to the Median section of OneSignal's documentation.

Setting up your OneSignal Account

OneSignal offers a free tier account with unlimited push notifications for native apps built using Median. To get started, create an account at https://onesignal.com

Configure OneSignal

iOS

OneSignal sends push notifications through Apple's APNS service. You will need to provide OneSignal with your Apple Push Notification certificate generated on https://developer.apple.com

A complete guide for this is available on OneSignal's website at https://documentation.onesignal.com/docs/generate-an-ios-push-certificate.

🚧

iOS Push Notification Capability Required

Prior to publishing your app add the Push Notifications Capability within Xcode per the screenshot below

πŸ“˜

Clear Badge count on iOS - App Groups Capability Required

App Groups capability is required for OneSignal to communicate with your app for clearing push notification badge count. You must add the App Groups capability to Main App Target and OneSignalNotificationServiceExtension Target.

For both Targets, set the App Groups container to be group.YOUR_BUNDLE_IDENTIFIER.onesignal where YOUR_BUNDLE_IDENTIFIER is the same as your Main Application "Bundle Identifier".

Detailed steps with screenshots are available on OneSignal's website at https://documentation.onesignal.com/docs/ios-sdk-setup#3-add-app-groups.

It's not required to add App Groups capability if you are not sending Push with Badges from OneSignal.

Android

OneSignal sends push notifications through Google's Firebase Cloud Messaging (FCM) service. You will need to provide OneSignal with your Google Project Number and Firebase Server API Key.

Once you have a Google developer account set up, you may generate your Project Number and FCM Server API Key directly: https://developers.google.com/mobile/add?platform=android&cntapi=gcm

A complete guide is available on OneSignal's website at https://documentation.onesignal.com/docs/generate-a-google-server-api-key.

Configure your Median App

Median requires just your OneSignal App Id to configure OneSignal to send notifications to your app. You will find this on your OneSignal Dashboard under App Settings -> Keys & IDs.

Sending Notifications with OneSignal

Whenever a user installs your app and launches it for the first time, it will register itself to receive push notifications and a device record will show up within your OneSignal dashboard. You'll then be able to send push notifications to your users through OneSignal's online dashboard, or programmatically through the OneSignal Server REST API.

You may optionally provide a URL to open within your app when the notification is tapped. See Open URL from Notification for the required settings.

You may send the same push notification to all users at once, to a group of users, or you may also send personalized push notifications to an individual user. Please see Personalized Push for more information about associating push tokens with specific users.

You may also use your own custom notification sounds when sending push notifications. Please see Custom Notification Sounds for the required settings.