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 app name will open Dashboard of the app:
Image without caption
3) Go to Settings tab:
Image without caption
4) **Keys & IDs **section:
Image without caption
5) Copy your app id (OneSignal App ID) and place it in plugin tabs.
6) For "Authorization (shared header)" you need to copy your Rest API Key from "Keys & IDs" tab.
Copy Rest API Key from OneSignal Dashboard, add "Basic ``Your Rest API Key" in this field:
Image without caption

Google Service Account

In order to connect IAP for Android applications you need to create a Service Account.
1) First, go to your Google Play Console.
2) After selecting the account you will see a page with all your apps:
Image without caption
In the left part of the page is placed a sidebar with different sections.
3) You need to find API access:
Image without caption
Image without caption
4) In the bottom part of this page you can see Service accounts block:
Image without caption
5) Click on Create new service account
You will see popup with instructions from google:
Image without caption
6) Open Google Cloud Platform
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 list of accounts:
Image without caption
7) Now click on account settings and select "Manage keys":
Image without caption
8) Add key:
Image without caption
Image without caption
9) Select JSON type:
Image without caption
10) The key will be downloaded on your PC:
Image without caption
11) 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
12) Go to APIs & Services:
Image without caption
13) Select "Enable APIs and Services"
And find Google Play Android Developer API
Image without caption
14) Enable this API:
Image without caption
Approving new permissions for service account can take 24 to 48 hours.
Service account will appear in list of accounts:
Image without caption
15) Click "Grant Access" and select Admin level of permissions:
Image without caption

Apple Shared Secret

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 for.
2) In sidebar select "Subscriptions":
Image without caption
3) Scroll to 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 shared secret and place it in specified field in 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 > Keys > 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.

Bundle ID

Go to App Store Connect > App Store > 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.

Air Native Element

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 apear in message on android device

Get OneSignal deviceID

This action return OneSignal deviceID (Player ID) in plugin state OneSignal Device ID then triggers the event Device ID Getted
Image without caption

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 that 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
Hight Accuracy
Is a boolean representing if 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 to exceed before returning 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.

Toggle Header Button

Show/hide header button if it is enabled in the build.
Image without caption

Change Color of 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 plugin states IAP - Purchase Data and IAP - Transaction ID information about last transaction. Then purchase is succesfull 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. Information about error will be shown in alert message.
Image without caption
Image without caption
Image without caption
Title
Description
Product ID
Product ID from 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 transaction using its Transaction ID. Transaction ID is stored in 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 user device. Don't forget to set Contacts type in 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 android device can be empty - if is loaded from 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 app try to get contacts data
IAP - Current Purchase Is Subscription
Return 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 transaction is active
Can be Yes or No

Events

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

Air Native - Process Purchase

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

OneSignal Push Notifications

Air Native uses OneSignal RESTful API for push notifications.

OneSignal push notification to individual

Sends notifications to your 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

OneSignal push notification to list of users

Sends notifications to 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"]
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 notification to segment

Sends notifications to specific segment of users.
Image without caption
Title
Description
message
The notification's content
Title
The notification's title
segments
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 individual

Sends notifications using predefined template to specific user.
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
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 predefined template.
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
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

How to create a product

App Store Connect

Go to App Store Connect and select your app.
Go to Subscriptions menu:
Image without caption
Create new subscriptions group:
Image without caption
Create new subscription:
Image without caption
Set name and product id of your subscription and click "Create":
Image without caption
Now you can set up your subscription:
Image without caption
Set subscription duration:
Image without caption
Set 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 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

Select your app an go to 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 plugin event "IAP - Purchase data is available" to continue IAP workflow:
Image without caption
3) Use "Air Native - Process Purchase" action:
Image without caption
Image without caption
4) Action "Air Native - Process Purchase" can be founded in Payment tab:

Test In-App purchases on iOS

If you are unable to test payments you need to create sandbox account for testing.
Go to Users and Access page in your Appstore Connect:
Image without caption
And add new Sandbox Tester:
Image without caption
Use this account for authentification when you make purchase.

OneSignal iOS Push Opt-In Prompt

- Android devices should be subscribed to push notifications immediately upon opening the app. - iOS devices should be prompted to subscribe to push notifications.
You can configure iOS Push Opt-In Prompt - 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 - Native. Place this element on the working page and use all its available features.

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.