1. Home
  2. Tutorials
  3. Using Native Functionality
  4. Receive Push Notifications from OneSignal

Receive Push Notifications from OneSignal

onesignal notification app

You can send your app users notifications from OneSignal. Your Dropsource project can detect notifications being received and opened, as well as accessing the information contained within them.

ⓘ Note

To test OneSignal notifications on iOS you will need to enter your Dropsource app testing Bundle ID into OneSignal – your Bundle ID for testing will be “com.dropsourcetesting.project-id” where “project-id” is the string of numbers you’ll see in your project URL after “project/”.

You will also need a push certificate – contact Dropsource support and we’ll provide that for you (note that you’ll need a different certificate for your production app before deploying it).

You can only test the notifications on a physical mobile device, not in the simulator.

  1. If you haven’t already done so, create a project and configure it from the OneSignal dashboard.

    create onesignal app

    Select iOS or Android.

    ⓘ Note

    On iOS you may find it helpful to create two separate apps in OneSignal – one for testing and one for production. The Bundle ID for your production app will be different as it will be tied to your Apple developer account. You can therefore e.g. create a project named “Dev” for testing (using the “com.dropsourcetesting.*” ID certificate) and one named “Prod” for release (using the certificate tied to your Apple Developer account) – in both cases add the certificate as the production option.

  2. Follow the steps to configure your app for the iOS or Android platform.

    onsignal configure

  3. Select your SDK.

    onesignal sdk

    ⓘ Note

    At this point on iOS you will be prompted to enter your certificate. Send Dropsource support a message via the Help button in the editor including the build ID for your latest project Mobile device build (not simulator). Note that you can move forward in OneSignal at this stage without the certificate and add it later.

  4. Open your Dropsource app and in Settings on the left of the editor, Edit your OneSignal details.

    dropsource onesignal settings

    Enter the App ID from your OneSignal Settings. On Android you’ll also need the Google Project Number you entered while configuring your OneSignal project (the Sender ID in your Firebase project).

  5. Build your Dropsource app using the Test button at the top of the editor and open it in the simulator from My Builds in Android, on iOS build for a mobile device and open the app on the device, accepting notifications when prompted. Once your app has run, back in the OneSignal dashboard configuration screen, click Check Subscribed Users.

    onesignal install

    You should see confirmation that you have your first subscribed user. Once your configuration steps are complete you can close the configuration settings.

    onesignal config complete

    Your dashboard will indicate your new subscribed user.

    onesignal subscribed

  6. In Messages, select New Message to send your first notification.

    new onesignal message

    Select your audience and click Next.

  7. Enter your notification content, including a title and message body.

    onesignal message

    Click Next.

  8. Select your message options. You can set a variety of details on the notification UI and associated data, however to send a simple test message you can just click Next.

    onesignal options

  9. Select scheduling options for your notification and click Next.

    onesignal schedule

  10. Check through all of the details in the confirmation screen and, if you’re happy with your settings, click Send Message.

    onesignal confirm

  11. Test your Dropsource app on a mobile device to receive the notification. It should appear as soon as the app runs. If the app is open when the notification arrives it will appear over the screen. Otherwise, depending on your platform / OS version, it will appear in the notification bar / by swiping down to see your notifications, and clicking it will open your app / bring it to the front.

    onesignal notification app

    Your OneSignal dashboard will update with any clicks on notifications sent.

    onesignal notification clicks

    You can view various stats related to messages you’ve sent in the past, including conversion info.

  12. Respond to notifications in your Dropsource app. If you need to detect notifications being received or clicked within your Dropsource app you can do so. Open Lifecycle on the left of the editor. Open the OneSignal Event you need.

    onesignal lifecycle

    In any Actions you add to a OneSignal notification Event, you can access the notification data via the Event Data. Typically you will save the data in Device Variables, then process or display it when an Event occurs in one of your app pages.

    onesignal event

You can integrate your OneSignal notifications setup with an API to automate sending messages to your users. You can also create templates to reuse elements of your OneSignal notification messages, and can carry out A/B testing. Your Dropsource app can also build the notification message data into its processing, for example showing the user particular content when they respond to a notification.

Was this article helpful to you? Yes No

How can we help?