Bravo Studio Help Center
  • Get started with Bravo Studio 👏
  • Get Started
    • 🚀Create your first app
    • 🌟Bravo introduction
      • Get ready to create your app with ChatGPT
      • Create an app
        • Creating an app with Figma
        • Creating an app with Adobe XD
      • Duplicate an app
      • Delete an app
      • Replace linked Figma file
      • The app page
      • Sharing your app
      • Add an editor to your app
      • Fonts
        • Adobe XD - Supported fonts
    • 📱Bravo Vision previewer
    • ✨Unlock power features to create interactive apps
    • 🎓Help and tutorials
      • 📖App guide tutorials
        • Sample app tutorial: Your first binding
        • How to build a Fitness app with Bravo, Xano and RevenueCat
        • Foodgram: Social content sharing
        • Expedition journal: Write and share your adventures
        • My Subscriptions: Display data based on device ID
        • My Notes: using user ID and email from Firebase
        • My Store: Sell physical products with Bravo and Stripe
        • Titan: How to create a Smart Home App with No-Code?
        • n8n: Building an expense tracking app in 10min
      • 📺Learn with videos
      • 📚Learn with articles
      • 🗃️Browse by app feature
        • Save or "bookmark" a page
        • Backend search with Airtable
        • Backend search with Xano
        • Nested lists (list within a list)
        • Create and edit user profile (Firebase + Airtable)
        • Skeleton loader
        • Create albums in your app with Bravo Infinite images
  • Set up your design
    • 🖌️Get your Figma ready for Bravo
      • 🗃️Structuring the design: the layer hierarchy
      • 🪄Bravo Tags: adding functionality to the UI elements
      • 🧱The container
        • Setting up a container on Figma
        • Setting up a container on Adobe XD
      • 📲App navigation
        • Setting up app navigation on Figma
        • Setting up app navigation on Adobe XD
    • 🔌Bravo plugin for Figma
    • 💾Sample design files
    • 🤓Best Practices
  • App components
    • 📒Bravo Tags Master List
    • 🚪Menus
      • Modal Menu
      • Modal pages
      • Tabs Menu
      • Pop Up pages
      • Slide Menu
    • 🍞Pages
      • Modal pages
      • Pop-up pages
      • Swipe page
      • Transitions page
      • Page reveal animations
      • Page tabs
      • 🔮Stateful pages
    • 📦Containers
      • Swipe to delete
      • Top bar
      • Carousel slider
      • Aspect ratio relative to screen
      • Sortable List
      • Layer (sticky element)
    • 👋Intro & Onboarding
      • Intro page
      • Post-login page (Onboarding)
    • ⌛Loading experience
      • Loading page
      • Custom loading page
      • No loading
      • Preload
    • 📝Form & input fields
      • 👁️Password Visibility Toggle
      • 🩷Stateful input
        • ☑️Checkboxes (Multiple select)
        • ✅Required Checkbox
        • 🔘Radio buttons (Single select)
      • ⏳Input time Interval
      • 📄Dropdown selector
      • 🎚️Slider control
      • 🗓️Calendar picker
      • 📄Send form input to a database
    • 💎Components
      • Autoplay Video
      • GIF
      • SVG Component
      • Web view
      • Web Components using AI
      • Web view communication
      • LottieFile
      • Lottie-animated component
      • Flexible text (Flexo)
      • Zoomable image
      • Component states
      • Stateful component (like button)
      • Setting up the backend of Stateful component (like button)
      • Haptic Feedback (Buzzz)
      • Progress bar
      • Rich text
      • Date, Time and Currency Formatter
      • Scrollable text
      • Text Lines & Truncation
      • Status bar
    • ⚡Mobile actions
      • Mobile Actions
      • Play audio
      • Record audio
      • Play video
      • Scan QR code (external URL)
      • Scan codes (remote action)
      • Search & filter
      • Refresh page
      • Share location
    • 📱App Icon & Splash Screen
    • 🗺️Map with markers
    • 📈Charts
  • Data and Backend
    • 🗂️Set up a no-code backend
      • Xano
        • Nested lists (list > list > detail page) with Xano
        • Create a bookmark functionality with remote actions and device ID with Xano
        • Multi-user setup with Xano
        • 🔒Setting up the Xano Log in Snippet
          • ♻️Refresh Token
      • Airtable
        • Nested lists (list > list > detail page) with Airtable
        • Sort list with Airtable
        • Connect multiple tables from Airtable to one app
        • Update Airtable's API key to Access Token
      • Backendless
      • Bubble
      • Notion
        • Getting data from a Notion table
      • Firebase
        • Getting data from Firestore
    • 💾Set up API requests
      • Set up from scratch
        • Airtable
          • Set up an API GET request for list page - Airtable
          • Set up an API GET request for detail page - Airtable
          • Set up an API POST request - Airtable
          • Set up an API DELETE request - Airtable
        • Xano
          • Set up an API GET request for list page - Xano
          • Set up an API GET request for detail page - Xano
          • Set up an API PATCH request - Xano
          • Set up an API POST request - Xano
          • Set up an API DELETE request - Xano
      • Using GraphQL body type
      • Set up with API wizard & importer
        • Using the Airtable API Wizard
        • Using the Xano API wizard
    • 🎲Variables
      • Built-in variables
      • Set Variable
    • 📚Data Collection & Binding: Complete Collection
    • 🗂️Pagination
    • 🐛Debugging API issues
      • ⚙️Debugging requests in the API Collection
      • 📲Event logger
      • 🔗Link property
  • Data binding
    • 🤝Data binding types
      • API binding types
      • Bind multiple API requests to one screen
      • How to connect my API to a mobile actions
      • Remote actions: trigger an API request with a UI element
    • 💡Display data in your app
      • Bind data to design for a list page
      • Bind data to design for a detail page
    • 🆕Create data from your app
    • 🗑️Delete data from your app
    • 🚦Conditional Visibility
    • 🎛️Conditional Actions
  • Integrations & Settings
    • 🖇️Deep Links
      • 🖇️Deep Links for Bravo Vision
      • 🖇️Deep Links for published apps
      • 🖇️Troubleshooting Deep Links
    • 🔔Push Notifications with OneSignal
      • How to get a Bravo page URL
    • ⚙️Firebase Configuration
    • 🔐User Authentication
      • 🔑Authentication with Kinde and Xano
      • 🧙🏽Authentication with OAuth 2.0
        • Using social logins to authenticate users
        • Using AWS Cognito to authenticate users
        • Connecting to Spotify API
      • 📲User login with Firebase
        • ✉️Email and password Login with Firebase
        • 📞Phone Login with Firebase
        • 🍎Social Login with Firebase
        • 👻Anonymous Login with Firebase
      • ⛓️Authentication with custom backend
        • Set up Xano as your user authentication backend
    • 💰Stripe: One-time Payment
    • 💬Chat: CometChat
    • 💸RevenueCat: In-app purchases and subscriptions
    • 📉Bravo Analytics
    • 📳Facebook App Events
    • 📊Google Analytics
    • 🌐Multilingual apps
    • 🕸️How to connect with Webflow API
    • 📡NFC connection
    • 🎯Admob
  • App Publication
    • 🚀Publishing your app
      • iOS Publication: Complete Process
        • 1. Generate Certificates, AppIDs and Provisions
        • 2. Get the IPA
        • 3. Upload IPA to App Store Connect
        • 4. Test your app on TestFlight (optional)
        • 6. App Store publication
        • 7. Updating an app in the App Store
      • Android Publication: Complete Process
        • 1. Create a Keystore File (optional)
        • 2. Get the Debug APK to install
        • 3. Install the Debug APK in your device
        • 4. Get the AAB (Android App Bundle) file to publish
        • 5. Google Play publication
        • 6. Updating an app in Google Play
      • Android APK Installation Guide
      • Rejection from the app stores
    • 🎛️Making changes to your app after publication
    • 🛍️Versioning
    • 🌟App rating alert
  • Good to Know
    • 🤔Troubleshoot
      • Errors when logging in
      • Errors when creating an app
      • Errors in API requests
        • Request timeouts on Bravo
      • Errors after importing
      • Errors in publication form
    • 🧑‍💻Manage your account
    • 💳Billing
      • Bravo Subscription Plans Overview
      • App Add-ons
      • Upgrading a plan
      • Downgrading a plan
      • App allowance
      • Invoices & payment method
      • FAQ
    • ❓FAQs
      • About Bravo Studio
      • Importing a design file
      • Bravo Vision
      • Bravo Tags
      • API & Data Library
      • Login & Account
      • Other Features
  • NEED SOME HELP?
    • 📖Bravo Support Guide
    • 🤝Join the Bravo community
    • 🤖Bravo Assistant
    • 👥Production support
    • 🐞Report an issue
Powered by GitBook
On this page
  • Use Case: Swipe Functionality with WebView Communication
  • Example file

Was this helpful?

  1. App components
  2. Components

Web view communication

PreviousWeb Components using AINextLottieFile

Last updated 11 months ago

Was this helpful?

To set up WebView communications, you need programming skills, especially in JavaScript, to handle interactions between the app and web content.

What is WebView communication? WebView Communications allow a embedded in a mobile to interact with the app by exchanging variables and triggering actions, enhancing the app's functionality and user experience. This involves using HTML, CSS, and JavaScript to create dynamic content that communicates with the app through an API.

How Does WebView Work in Bravo?

The crucial feature of WebView is its ability to communicate with the app that contains it. This is done by passing variables and sending actions between the WebView and the app.

  • Passing Variables: Variables can be sent to the WebView from the app. The variable should be called in the HTML. For instance, if you need to show an interactive map with specific data, you can pass that data from the app to the WebView to dynamically customize the content.

  • Triggering Actions from WebView: The WebView can also trigger actions in the app. Here are the actions that can be used: "goto", "goback", "openurl", "refresh", "logout". For example, in an autocomplete search function: once the user selects an item, the WebView can send an action to Bravo to navigate to a detail page, seamlessly transitioning from a web view to a native view.

Technical Implementation

HTML and JavaScript

The content of the WebView is essentially HTML, CSS, and JavaScript. This content is developed outside of Bravo but can interact with Bravo through an API provided by the app.

Messaging Between WebView and the App

For the WebView and the app to communicate, a technique similar to in web development is used. Communication is done through messages sent and received between the app and the WebView.

Use Case: Swipe Functionality with WebView Communication

This is a generic WebView component with swipe functionality, similar to what you might find in a dating app. As the user swipes left or right, it triggers a go-to action within Bravo to display a pop-up of the swiped item.

To achieve this, you can use WebView Communication within Bravo. Here's how:

  1. Create an HTML which contains the following:

    1. Data Loading: It fetches data from a specified URL to populate the cards with information.

    2. Interaction Setup: A swipe-based interaction system for cards, allowing users to swipe left or right to navigate through content.

    3. Bravo Integration: Upon completing a swipe, the code sends a message to Bravo via WebView Communication, indicating the direction of the swipe and triggering corresponding actions within the Bravo app. For instance, when a user swipes left or right, trigger a go-to action within Bravo to display a pop-up of the swiped item.

Below is a demonstration of the code interacting with the WebView:

if (successful) {
    // throw card in the chosen direction
    this.topCard.style.transform =
        'translateX(' + posX + 'px) translateY(' + posY + 'px) rotate(' + deg + 'deg)'

    // send message to bravo
    if (direction_page) {
        const params_str = btoa(`{"name":"${this.topCard.textContent}"}`)
        const href_remote_str = `https://apps-service.bravostudio.app/devices/apps/${appid}/node/${direction_page}?params=${params_str}`
        const message = { "action": "goto", "params": {"href": `${direction_page}`,"hrefRemote": href_remote_str} };
        console.log(message)
        if (window.bravo != undefined) { window.bravo.postMessage(message); }
    }
    // wait transition end
    setTimeout(() => {
        // remove swiped card
        this.board.removeChild(this.topCard)

        // add new card
        this.push()
        // handle gestures on new top card
        this.handle()
    }, 200)
}
  • If the swipe gesture is successful (if (successful)), a message is constructed containing information about the swipe direction and the content of the swiped card.

  • The constructed message is then sent to Bravo using window.bravo.postMessage(message).

Message Construction: message is constructed as a JavaScript object containing two main properties:

  • "action": Specifies the type of action to be performed by the Bravo app. In this case, it is set to "goto", indicating a navigation action.

  • "params": Contains parameters related to the action, including:

    • "href": Specifies the destination page within the Bravo app. It is set to direction_page, which determines the specific page or screen to navigate to.

    • "hrefRemote": Specifies the remote URL constructed earlier (href_remote_str), which provides additional information or parameters for the Bravo app to process during navigation.

In this example, this is where the interaction with WebView Communication occurs, as it sends data from the web content (the swiped card) to the Bravo app for further processing or action triggering.

Using WebView in Bravo opens up many possibilities for creating more dynamic and functional hybrid apps. It allows combining the best of web and native worlds, offering an enriched user experience and advanced functionalities that wouldn't be possible otherwise.

Example file

Duplicate the files below to see how to set it up!

For more in-depth information and to understand the basics of window communication in JavaScript, you can check out this .

Your feedback is valuable to us. If you have any suggestions, questions, or issues, please don't hesitate to reach out to the .

💎
🃏
web view
iframes
detailed article
community