Push Notifications by One Signal

Push Notifications cannot be tested with the Thunkable Live app on iOS You can test Push Notifications on iOS by publishing your app to TestFlight and downloading it from there.

Push notifications are one of the biggest advantages that mobile apps have over mobile websites, since they can send messages to users without the app being open.

However, annoying notifications---those that are irrelevant and too frequent---can be dismissed or blocked easily. We highly recommend sending notifications only when the content is relevant to the user. Examples of this include an e-commerce app notifying users of a sale, or a game notifying users of new levels and features.

Properties

PropertyDescriptionData Type

Android App ID

App ID for Android from OneSignal

Text

iOS App ID

App ID for iOS from OneSignal

Text

Geolocation Enable (Android Only)

Toggle whether your end user is asked for permission to share their location

True/False

Geolocation Permissions

OneSignal allows you to push messages to users in certain locations. You will need permission from your end users to register their location to use this feature. You can toggle whether you request geolocation permissions from your end users in the Push Notifications settings panel.

Sign up with One Signal

One Signal is a free service that supports unlimited devices and notifications. You can learn more about their features on the OneSignal pricing page

After you have signed up, click Add App and enter in your app name:

After adding your app, OneSignal will ask you to select a platform. Below, we have created guides for both Android and iOS.

At this time Push Notifications can only be tested on Android Devices.

You can add Push Notifications to iOS apps but testing can only be done after an app is published to the App Store.

Android Setup

Setting up push notifications for Android is relatively straightforward. Here's a quick overview of the steps, followed by a more detailed walk-through.

  1. Toggle Location Permisson

1. Select Your Platform

After you have added an app and given it a name, select the Google Android option.

2. Configure Your Platform

For this next step, you will need a Firebase account.

For instructions on how to set up a Firebase account, please click here.

Once you are signed in with Firebase, create a new project.

Once you have created a new project, click on the gear icon beside Project Overview and select Project settings.

Select the Cloud Messaging option:

There are two things that you will need to copy and paste back into One Signal:

  1. Server Key

  2. Sender ID

Go back to the One Signal platform.

Earlier you should have selected the Android option on One Signal, and your screen should look like this:

Copy and paste the Firebase Server Key and the Firebase Sender ID sections into One Signal.

3. Select Your SDK

The last thing you need to do in OneSignal is choose your target SDK. Select Native Android and click next to continue.

4. Install Your SDK

Copy the alpha numeric code that OneSignal generates called Your App ID in the image below.

On Thunkable, click on the icon at the bottom of your design screen to open the Push Notifications dialog and paste this ID into the Android App ID field.

Click the Live Test button. Once the app is on your phone, go back to One Signal. Click the "Check Subscribed Users" button.

If you are live testing or have downloaded your Android app, you should see a congratulations message. Click "DONE".

Select the "MESSAGES" option and then select "NEW PUSH". You will now be able to create push notifications and send them to your app users.

Toggle Location Permission (Android Only)

OneSignal is a powerful choice of push provider. With their platform, you can setup for your users to be pushed notifications based on their locations. This is optional, however. This also means you need to make a conscious decision as to whether or not to track your Android users geographical locations. These tracking data can be accessed via the OneSignal dashboard. This feature can be toggled on and off in the Push Notifications settings by clicking on the icon at the bottom of your design screen.

iOS Configuration

Generate a p8 Certificate

  1. When you get to the section titled "Provisioning Profiles," return to these instructions.

  2. Follow OneSignal's instructions to generate a p8 certificate: iOS: p8 Token-Based Connection to APNs.

Add Push Notifications to the App Identifier

  1. In your Apple Developer account, select Identifiers under the Certificates, IDs & Profiles heading.

  2. Select your app from the list of Identifiers.

  3. Scroll down the list of app capabilities, and place a checkmark next to Push Notifications.

  4. Click Save.

  5. Select your app from the list of Identifiers again.

  6. Scroll down the list of app capabilities, until you get to Push Notifications again.

  7. Click the associated Configure button.

  8. Under Production SSL Certificate, click Create Certificate.

  9. Under Upload a Certificate Signing Request, click Choose File.

  10. Select the Certificate Signing Request (CSR) you downloaded from Thunkable as part of the publishing process.

  11. Click Continue.

  12. Click Download to download your iOS certificate.

Download your Provisioning Profile

  1. Access your Apple Developer account’s Profiles.

  2. Select your app from the list of Profiles.

  3. Click Edit.

  4. Click Save.

  5. Click Download

OneSignal

  1. In OneSignal, select Native iOS as your target SDK.

  2. Click Save & Continue.

  1. Copy Your App ID.

  1. Return to the Blocks tab of your Thunkable project. Do not close the OneSignal tab.

  2. Click on the icon at the bottom of your design screen to open the Push Notifications dialog and paste this ID into the iOS App ID field.

Generate a Provisioning Profile

You require a new provisioning profile with push notifications enabled to publish to the App Store. See OneSignal's instructions here: Generate a Provisioning Profile.

iOS Testing

To test iOS push notifications, you have to publish to TestFlight. This requires the provisioning profile with push notifications enabled.

Send Push Notifications

Once you have your platforms configured in OneSignal you can create and sent push notifications to your app's users. Follow OneSignal's instructions here: Sending Messages.

Blocks

Functions

User ID

The first time your app is opened on a new device, it is automatically assigned a unique push notification user ID. This block returns the user's push notification user ID that can be used to send a notification to a specific user with a web API call.

Push Notification Properties

Property NameiOSAndroid

Toggle Geolocation Permission

n/a

available

Toggle Geolocation Permissions

With the power of OneSignal comes the ability to push messages to users in certain geographical locations. This is optional, however. This also means you need to choose between tracking or not tracking users geographical locations. These data can be accessed via the OneSignal dashboard.

If you enable Geolocation Permissions, when you publish your app, ensure that you indicate that you're tracking location when you publish your app.

Last updated

Change request #43: live test