OneSignal
Engage your users with OneSignal Push Notifications and In-App Messages
Overview
OneSignal is a powerful, scalable push notification platform ideal for apps ranging from startups to enterprise solutions. When integrated with Median, it allows you to deliver rich push notifications on both iOS and Android platforms.
Developer Demo
Display our demo page in your app to test during development https://median.dev/onesignal/
Key Features
- Flexible Targeting: Send push notifications to individual users, specific device groups, or all app users.
- Multiple Delivery Methods: Send messages via the OneSignal Dashboard or programmatically using the OneSignal REST API.
- Custom Actions: Define a targetUrl to open in-app when users tap a notification.
- Advanced Capabilities: Supports custom sounds, badges, notification collapsing, and more.
Median OneSignal Integration
Median offers an official OneSignal integration, making it easy to incorporate native push notifications for both iOS and Android.
Our documentation provides a comprehensive guide to the Median OneSignal integration. You can also refer to the Median section of OneSignal's documentation.
Legacy Mode
Your app will integrate with the latest OneSignal iOS and Android SDKs (v5+) and user-centric data model by default. With Legacy Mode enabled your app will instead fall back to OneSignal’s previous iOS v3 SDK and Android v4 SDK, which both support the device-centric data model.
OneSignal will eventually cease support for its older, device-centric SDKs and APIs, including version 4 and below for mobile. While they'll continue to maintain these older versions, they will follow their typical end-of-life policy, meaning they won't be actively supported or updated.
📖 Learn more: Legacy Mode
Getting Started
Setting up your OneSignal Account
Get started with a free OneSignal account that supports unlimited push notifications for native apps built with Median. Sign up at https://onesignal.com
Configure OneSignal
iOS
OneSignal uses Apple Push Notification Service (APNS) to deliver notifications on iOS. 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.
Enable Push Notification Capability
Prior to publishing your app add the Push Notifications Capability within Xcode per the screenshot below. You can also learn more about Adding Capabilities in our dedicated guide on how to build iOS apps from source.
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
whereYOUR_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 Service Account JSON.
You can find a walkthrough of creating your Google Project Service Account JSON in our Google Service documentation.
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.
Frequently Asked Questions
Why did I receive a 'OneSignal Notification Service Extension requires a provisioning profile' error?
In order to support "rich media" notifications on iOS, Apple requires that a Notification Extension be added to your Xcode project.
You may see this error message when building your iOS source code via Xcode. It has a very simple solution.
In order to support "rich media" notifications on iOS, Apple requires that a Notification Extension be added to your Xcode project. We have already done this for you, but this Notification Extension appears as an additional "Target" in your Xcode project and must be signed separately.
The easiest fix is to select the Notification Extension target, and sign it the same way you signed your main app's target. If you selected "Automatically Manage Signing" for your main app, please do the same for the Notification Extension.
Updated 5 months ago