To get started, install the Median Bubble Plugin in the Bubble app editor via Plugins -> Add Plugins -> Median Plugin.
Suppose we need to set brightness of the device to 80% when user clicks a button. To accomplish this, drag a button from the "Elements" section on your page and change its name to "Set Brightness" or as desired:
Once the button is created, click "Start/Edit workflow" and you will see the following page:
The final step in configuring a workflow/action is to modify the action as required. In our case, we will set the Brightness value to 0.8 and set the "Restore on navigation" field to "no" as shown below:
You can also assign a dynamic value to the brightness field so that it takes the value of an element as its input.
The dynamic value can be a text input, a slider, or any one of the elements from which a value can be read. For instance, to set the dynamic value as a slider value, drag and drop a "Slider Input" element from the "Elements" section to your page. Since the acceptable brightness values in Median apps is between 0 and 1, set the min and max values of the slider element to 0 and 1 respectively and set the "Step" to 0.1 as shown below:
Once the Slider Input element is configured, go to the "Workflow" section and create a new event to trigger when your slider's value is changed. Choose the "An input's value is changed" option and then select your slider element:
Now add an action to the slider and select Plugins -> Median Screen Brightness. If you click on the "Brightness" field, you will see the option "Insert dynamic data" as shown below:
After clicking the option, you will see a list of all elements that you have in your page. Select your slider element and then choose "This SliderInput's value" to read the element's value.
Once this action is configured, your app will read the brightness value from the slider input when setting the brightness level.
Returned data variable
All the data that Median returns from the app can be accessed in your custom callback script by the variable named "data".
document.getElementById("contacts_output").value = JSON.stringify(data);
median.contacts.getAll(). This function returns a JSON object containing the user's contact list that you can send to your server via AJAX calls OR pass it to one of the Bubble's elements such as the "Multiline Input" as seen in the following example.
First, you will need to enable the ID Attribute in your elements by going to Settings -> General and check the option "Expose the option to add an ID attribute to HTML elements". Now, drag the multiline input element to your page, double-click it and set its ID Attribute (at the very bottom) to a unique string (such as
Note: Since this ID Attribute will be used to identify a unique element in a given page, it has to be a unique string.
Once complete, go to your Workflow section, then open the "Median Native Contacts" action you want to read the data from, and paste the custom callback script as shown below. Replace
contacts_output with the ID Attribute of your multiline input element. This script will set the value of the element with the ID Attribute
contacts_output (in our case, the Multiline Input) to the "stringified" JSON object that the Native Contacts Plugin returned.
- Set Screen Brightness
- Set Status Bar
- Download file / image
- Share Page
- QR / Barcode Scanner
- Device Info
- Set Navigation Titles
- Set Sidebar Items
- Set Tab bar Items
- Set Navigation Levels
- OneSignal Info and Set / Remove External User ID
- OneSignal Show Tags UI
- Native Contacts
- Firebase Analytics - Set User and Log Events
- Send Facebook Events
- iOS ATT consent Request / Get Status
- Show/Hide iOS Contextual Navigation Toolbar
- Social Login Server-side Redirect functions
Updated about 2 months ago