This guide will help you set up the plugin in your Bubble editor to make it work properly.
​This plugin is a bridge between your native shell and your Bubble app.

Prerequisites

OneSignal

Setup keys in plugins tab.
Image without caption
Your OneSignal App ID can be founded in OneSignal console.
1) Find your app in the list of apps:
Image without caption
2) Clicking on the app name will open the Dashboard of the app:
Image without caption
3) Go to the Settings tab:
Image without caption
4) **Keys & IDs **section:
Image without caption
5) Copy your app ID (OneSignal App ID) and place it in the Air Native plugin tabs.
6) For "Authorization (shared header)" you need to copy your Rest API Key from "Keys & IDs" tab.
Copy the Rest API Key from OneSignal Dashboard, and add "Basic ``Your Rest API Key" in this field:
Image without caption

Google Service Account (this section is required only if your Android app contains In-App Billing or Subscriptions)

To connect IAP for Android applications you need to create a Service Account.
1) First, go to your Google Cloud account.
2) Select your project from the Dropdown and select Create Service Account.
Image without caption
Image without caption
⚠️
Don't skip step 2 "Grant this service account access to project". You can select role "Owner" - this role give full access and grant all permimssions
Image without caption
Created account will appear in the list of accounts:
Image without caption
3) Now click on account settings and select "Manage keys":
Image without caption
4) Add key:
Image without caption
Image without caption
5) Select JSON type:
Image without caption
6) The key will be downloaded on your PC:
Image without caption
7) Open the downloaded file with any text editor and complete fields in plugin tabs using data from this file:
Image without caption
Image without caption
Image without caption
8) Go to APIs & Services:
Image without caption
9) Select "Enable APIs and Services"
And find Google Play Android Developer API
Image without caption
10) Enable this API:
Image without caption

Apple Shared Secret (this section is required only if your iOS app contains In-App Purchases or Subscriptions)

To offer in-app purchases, you must accept the Paid Applications Agreement in App Store Connect. For details on how to do this, read Agreements, Tax, and Banking Overview.
1) Go to App Store Connect -> My Apps:
Image without caption
Select the application for which you are setting up purchases.
2) In the sidebar select "App Information":
Image without caption
3) Scroll to the bottom until you will see "App-Specific Shared Secret" and select Manage:
Image without caption
If you don't see your shared secret - generate it:
Image without caption
4) Now copy Apple's shared secret and place it in the specified field in the plugins tab:
Image without caption

Apple Private Key ID, Apple Issuer ID, Apple Private Key, Bundle ID

💡
To make the subscription status feature work, it is required to set up the Apple Private Key ID, Apple Issuer ID, and Apple Private Key. All three are located in the same App Store Connect.

Apple Private Key ID, Apple Issuer ID, Apple Private Key

1) Go to App Store Connect > Users and Access > Integration > In-app Purchase section:
Image without caption
2) Click the + button to create a new key and give it any name you prefer, e.g.:
Image without caption
3) Copy the keys and paste them into the Plugins tab in your Bubble editor:
Image without caption
💡
To get the Apple Private Key, hit the “Download In-App Purchase Key” button to get the .p8 file with your private key.
Image without caption
4) Once downloaded, open the file with any text editor:
Image without caption
Important: Add the \n at the end of each line, like this:
Image without caption
And remove the spaces between the lines, so it looks like a complete key in a single row, like this:
Image without caption
Now simply copy this value into the Apple Private Key field in the Plugins tab.
Image without caption

Bundle ID

Go to App Store Connect > Distribution > App Information section to copy the Bundle ID value:
Image without caption
Now simply paste it into the Bundle ID field in the Plugins tab.
Image without caption

- Air Native Element - For optimal functionality in the native app, it's crucial to have only one plugin element per page, and it should remain visible at all times.

Image without caption

Air Native plugin - Actions

Biometric Scanner

This action brings up a context menu of the device with a request for biometric data. On iOS devices, it will prompt Touch ID/Face ID. On Android devices, it prompts for fingerprints.
Image without caption
Image without caption
Image without caption
Title
Description
Title
This text will appear in messages on Android device

Get OneSignal deviceID

This action return OneSignal deviceID (Player ID) in the plugin state OneSignal Device ID then triggers the event Device ID Getted
Image without caption
ℹ️You can save the OneSignal deviceID in your Database and use it further to send Push Notifications to the Current User or a List of users.

Alert Word

Launches an alert dialog with the specified title and message.
Image without caption
Image without caption
Image without caption
Title
Description
Title
The dialog's title.
Text
An optional message appears below the dialog's title.

Stop Biometric Scanner

Stops fingerprint scanner listener, releases cache of internal state in native code, and cancels native prompt if visible.
Image without caption

Use vibration

Triggers a vibration with a fixed duration.
Image without caption
Title
Description
duration (sec)
Vibration duration in seconds

Share

Open a dialog to share text content.
Image without caption
Image without caption
Image without caption
Title
Description
Message
A message to share
URL
A URL to share

Start Location Tracking

Starts geolocation tracking. Information about geolocation is returned in plugin states: Current Position*, Moving Speed, Heading, Accuracy, *Altitude
Image without caption
Title
Description
High Accuracy
Is a boolean representing whether to use GPS or not. If set to true, a GPS position will be requested. If set to false, a WIFI location will be requested.
Distance Filter
The minimum distance from the previous location is to exceed before returning to a new location. Set to 0 to not filter locations. Defaults to 5m.
Maximum age (ms)
Is a positive value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to Infinity the device will always return a cached position regardless of its age. ( 1s = 1000ms )

Stop Location Tracking

Disable location tracking.
Image without caption

Change StatusBar Background Color

Set the background color for the status bar and status bar style.
Image without caption
Image without caption
Image without caption
Title
Description
Bar Style
Status bar style to set.
Animate Style Change
Animate the style change.
Color
Background color.
Animated
Animate the style change.

Change the Color of the Header Button

Set the color of header button if it is enabled in the build.
Image without caption
Title
Description
Color
Color of Header Button

IAP - Request Purchase

Request a purchase. This action stores in the plugin state IAP - Purchase Data and IAP - Transaction ID information about the last transaction. Then purchase is successful plugin event IAP - Purchase data is available will be triggered. If in a transaction an error is found - the plugin event IAP - Purchase data error will be triggered. Error information will be shown in the alert message.
Image without caption
Image without caption
Image without caption
Title
Description
Product ID
Product ID from the store.
Is Subscription
Type of product.

IAP - Cancel a subscription

Starting the unsubscribe workflow. For both iOS and Android, your users cannot cancel subscriptions inside your app. Users will be redirected to the App Store or Google Play.
Image without caption
Image without caption
Image without caption
Title
Description
Package Name
Package Name of your app
Product ID
Product ID of your subscription
Where do I find the Package Name? Go to Google Play Console
Image without caption

IAP - Check Active Purchase

This action is used to check status of the transaction using its Transaction ID. Transaction ID is stored in a plugin state with the same name.
Image without caption
Title
Description
Transaction ID
Transaction ID returned by action "IAP - Request Purchase"

Get Contacts

This action is used to get contacts from the user's device. Don't forget to set the Contacts type in the plugin element field. As type use stored with plugin type "Contacts Type".
Image without caption
Image without caption

Exposed states

Title
Description
Value
OneSignal Device ID
Onesignal Player ID. The OneSignal Player Id is a UUID that OneSignal creates per device per OneSignal App Id.
The format is lowercase letters and numbers 8 characters-4 characters-4 characters-4 characters-12 characters like b3aaabc2-9a47-4647-adda-3e4583a2d19e.
Current Position
Geographic address.
Moving Speed
Represent the velocity of the device in meters per second
Heading
Represent the direction towards which the device is facing. This value, specified in degrees, indicates how far off from heading true north the device is.
Accuracy
Representing the accuracy of the latitude and longitude properties, expressed in meters.
Altitude
Representing the position's altitude in meters, relative to sea level.
Device OS
Current user device OS.
Can be: ios - if app is running on ios device android - if app is running on an Android device can be empty - if is loaded from the browser
IAP - Purchase Data
Information about purchase.
List of Contacts
Return list of contacts from users device
List of Contacts Type.
Contacts Error Text
Error generated when the app tries to get contact data
IAP - Current Purchase Is Subscription
Return the boolean value indicated purchase type
Can be Yes or No
IAP - Transaction ID
Transaction ID from Purchase Data
String. Example:
IAP - Purchase is active
Using Transaction ID check if the transaction is active
Can be Yes or No

Events

Title
Description
Device ID Getted
Triggered when OneSignal returns the current user device ID
Biometric Data Correct
Triggered when the biometric scanner is successfully used
Biometric Data Error
Triggered when biometric scanner returns error
Right Button Clicked
Triggered when the right button in the header button is clicked
Center Button Clicked
Triggered when the center button in the header button is clicked
IAP - Purchase data is available
Triggered when purchase data is returned by the app
Contacts returned
Triggered when the list of contacts is returned by the app
Error in getting contacts
Triggered when an error occurs when requesting contacts
Air Native is initialized
Triggered when the plugin is connected to native app
IAP - Purchase data error
Triggered when an error occurs when requesting purchase data
Back Button
Triggered when the hardware back button is used on Android
IAP - Purchase checked
Triggered when purchase is checked
App Loaded From Background
Triggered when your app awakes from background

Air Native - Process Purchase

This action is server-side action. It is used for validation of purchase and acknowledgment of Android purchases. This action can be found in the "Payment" tab.
Image without caption
Title
Description
Sandbox
Indicates the type of server for purchase processing.
Device OS
Type of operating system. Use the plugin state "Device OS" as a value.
Purchase Data
Data returned by action "IAP - Request Purchase" and stored in plugin state "IAP - Purchase Data"
Is Subscription
Indicates if the product is a Subscription. Use the plugin state "IAP - Current Purchase is Subscription" as data for this field
Returned values: Successful - Boolean. Indicates if validation and acknowledge are successful. Message - Text. If validation is successful here will be stored information about acknowledge, else there will be an error message. Error - Text. If validation is successful this value will be empty, else there will be a stored error message.

OneSignal Push Notifications

Air Native uses OneSignal RESTful API for push notifications.

OneSignal Show Push Prompt

The OneSignal Push Prompt appears to verify the user's ability to receive push notifications. If the user does not accept this prompt, they will not receive any further push notifications.
Image without caption
Image without caption

OneSignal push notification to individual

Sends push notifications to one user.
Image without caption
Title
Description
message
The notification's content
Title
The notification's title
player_ids
Specific playerids (OneSignal Device ID state*) to send*
badge_type
Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.
badge_count
Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase
launch_URL
Used as Launch URL to open the native app. Can be also used to open a specific page. Please use your app URL, but replace the “HTTPS” protocol with your app scheme, e.g: ”zeroqodeapp://zeroqode.com” Make sure to insert the launch URl in double quotation marks ”zeroqodeapp://zeroqode.com”

OneSignal push notification to list of users

Sends notifications to a list of users.
Image without caption
Title
Description
message
The notification's content
Title
The notification's title
player_ids
List of player IDs (OneSignal Device ID). Example: ["364f17ae-591d-11ec-b9aa-5ad9a831a797","834f14ae-591d-11ec-m8sf-2ad6a531a744"] To avoid errors, we recommend using constraints that will filter empty player_IDs.
badge_type
Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.
badge_count
Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase
launch_URL
Used as Launch URL to open the native app. Can be also used to open a specific page. Please use your app URL, but replace the “HTTPS” protocol with your app scheme, e.g: ”zeroqodeapp://zeroqode.com” Make sure to insert the launch URl in double quotation marks ”zeroqodeapp://zeroqode.com”

OneSignal push notification to segment

Sends notifications to a specific segment of users.
Segments
Cohorts or Groups of users based on data collected and sent to OneSignal.
Image without caption
Title
Description
message
The notification's content
Title
The notification's title
segments
The segment names you want to target. Segment names can be found in OneSignal Console. Go to Audience -> Segments
badge_type
Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.
badge_count
Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase

OneSignal push template to individual

Sends notifications using a predefined template to a specific user.
Templates
OneSignal Reusable Push Notification, SMS, and Email Templates
Image without caption
Title
Description
template_id
Use a template you set up on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard. Example: be4a8044-bbd6-11e4-a581-000c2940e62c
Title
The notification's title
player_ids
Specific playerids (OneSignal Device ID state*) to send*
badge_type
Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.
badge_count
Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase

OneSignal push template to segment

Sends notifications using predefined template to segment.
Image without caption
Title
Description
template_id
Use a template you setup on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard. Example: be4a8044-bbd6-11e4-a581-000c2940e62c
Title
The notification's title
Segment
The segment names you want to target. Segments names can be founded in OneSignal Console. Go to Audience -> Segments
badge_type
Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.
badge_count
Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase

OneSignal push template to list of users

Sends notifications to specific segment of users using a predefined template.
Image without caption
Title
Description
template_id
Use a template you set up on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard. Example: be4a8044-bbd6-11e4-a581-000c2940e62c
Title
The notification's title
player_ids
List of player ids (OneSignal Device ID). Example: ["364f17ae-591d-11ec-b9aa-5ad9a831a797","834f14ae-591d-11ec-m8sf-2ad6a531a744"]
badge_type
Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.
badge_count
Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase

Understanding In-App Purchases

Steps to set up a product, either as a subscription model or as a one-time in-app purchase.

Auto-renewable Subscriptions - App Store - Apple Developer
Provide a seamless experience for auto-renewable subscriptions in your apps. You’ll receive more revenue for qualifying subscriptions after one year, have greater pricing flexibility, and more.
Auto-renewable Subscriptions - App Store - Apple Developer

App Store Connect (for iOS app)

Go to App Store Connect and select your app.
Go to the Subscriptions menu (or In-App Purchases, the steps are similar):
Image without caption
Create a new Subscription group:
Image without caption
Create a new subscription:
Image without caption
Set the Reference name and Product ID of your subscription and click "Create":
Image without caption
Now you can configure your Subscription:
Image without caption
Choose Subscription duration:
Image without caption
Add subscription price:
Image without caption
Add localization for your subscription:
Image without caption
Image without caption
You can add more than one localization:
Image without caption
Image without caption
To submit your payment you need to fill out these data forms:
Image without caption
Save your changes:
Image without caption
Your first subscription must be submitted with a new app version. Create your subscription, then select it from the app’s In-App Purchase and Subscriptions section on the version page before submitting the version to App Review. Learn More Once your binary has been uploaded and your first subscription has been submitted for review, additional subscriptions can be submitted from the Subscriptions section.

Google Play (for Android app)

Select your app and go to the subscriptions menu:
Image without caption
Create a subscription:
Image without caption
Follow Google's instructions for setting up the product:
Image without caption
Add base plan:
Image without caption
Save changes and activate the product:
Image without caption

How IAP purchases work

Image without caption

Set up IAP workflow

To separate iOS and Android use the conditions and state of the plugin Device OS
1) Use action "IAP - Request Purchase":
Image without caption
2) Use the plugin event "IAP - Purchase data is available" to continue the IAP workflow:
Image without caption
3) Use the "Air Native - Process Purchase" action:
Image without caption
Image without caption
4) Action "Air Native - Process Purchase" can be found in the Payment tab:

Test In-App purchases on iOS ℹ️Important - Before sending the app for review, ensure the Subscription works on different devices by using the sandbox account

If you are unable to test payments you need to create a sandbox account for testing.
Go to the Users and Access page in your Appstore Connect:
Navigate to the Sandbox page
And add a new Sandbox Tester:
Image without caption
Use this account for authentification when you make a test purchase.
Testing in-app purchases with sandbox | Apple Developer Documentation
Test your implementation of in-app purchases using real product information and server-to-server transactions in the sandbox environment.
Testing in-app purchases with sandbox | Apple Developer Documentation

OneSignal Push Opt-In Prompt

- Android devices should be prompted to subscribe to push notifications. - iOS devices should be prompted to subscribe to push notifications.
Setup Guide - See the description of the Show Push Prompt action above.
You can configure and customize the design of the iOS Push Opt-In Prompt within your personal OneSignal Console - Instruction from OneSignal.

Set up a custom icon for OneSignal Push Notifications

🔗
Here is a doc instruction on how to set a custom icon for push notifications to see them in the Notification Center.

Plugin Overview

Elements

The plugin comes with a single plugin element - AirNative. Place this element on the working page and use all its available features. ℹ️Ensure the plugin element is visible on the page load.

Data calls

The available data calls are listed below.
  • Air Native - OneSignal Push Template To Segment
  • Air Native - OneSignal Push Template To Individual
  • Air Native - OneSignal Push Template To List of Users
  • Air Native - Contacts Type
  • Air Native - Products Type

Events

The available events are listed below.
  • Air Native Device ID Getted
  • Air Native Biometric Data Correct
  • Air Native Biometric Data Error
  • Air Native Right Button Clicked
  • Air Native Center Button Clicked
  • Air Native (Deprecated) Products Is Fetched
  • Air Native IAP - Purchase Data is Available
  • Air Native - Contacts Returned
  • Air Native - Error In Getting Contacts
  • Air Native (Deprecated) Subscriptions Is Fetched
  • Air Native (Deprecated) Products Returned
  • Air Native Air Native Is Initialized
  • Air Native IAP - Purchase Data Error
  • Air Native Back Button
  • Air Native IAP - Purchase Checked
  • Air Native App Loaded From Background

Actions

The available actions are listed below.
  • Air Native - OneSignal Push Template To Individual
  • Air Native - OneSignal Push Template To List of Users
  • Air Native - OneSignal Push Template To Segment
  • Biometric Scanner A Native
  • Get OneSignal DeviceID Air Native
  • Alert Word Air Native
  • Stop Biometric Scanner Air Native
  • Use Vibration Air Native
  • Share Air Native
  • Start Location Tracking Air Native
  • Stop Location Tracking Air Native
  • Change StatusBar Background Color Air Native
  • Toggle Header Button Air Native
  • Change Color Of Header Button Air Native
  • (Deprecated) Get All Fetched Products Air Native
  • IAP - Request Purchase Air Native
  • (Deprecated) Fetch Products Air Native
  • IAP - Cancel A Subscription Air Native
  • Get Contacts Air Native
  • (Deprecated) Fetch Subscriptions Air Native
  • IAP - Check Active Purchase Air Native
  • Air Native - Process Purchase

​Table of Contents

In order to properly configure the plugin please read the *required sections of this documentation.
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Image without caption
Share
Content