Brifing

Building Smart Android Apps with Cloud and Hybrid AI

How to integrate advanced features using Firebase AI

Android Developers Blog2 min

1What is Cloud and Hybrid AI?

When developing AI features for Android apps, sometimes more powerful cloud models are needed. Hybrid solutions offer the flexibility to run both on-device and in the cloud. This approach reduces costs while ensuring compatibility across all devices.

2Museum Assistant Example

The museum assistant in Jetpacker app helps users access current exhibition information. Using Firebase AI's grounding feature, the model is fed with real-world data. URL, Google Search and Maps integrations provide visitors with instant information.

3Dynamic Context Grounding

Grounding techniques enable AI models to work with current information. For example, a museum's current ticket prices are pulled from its website and fed to the model. Firebase AI SDK automatically adds this data to prompts for accurate responses.

4Hybrid Inference Modes

The restaurant review feature demonstrates hybrid inference power. It prioritizes on-device Gemini Nano, falling back to cloud for unsupported devices. Firebase's Hybrid Inference API offers four routing modes: device-preferential, cloud-preferential, and strict options.

5Enhancing User Experience

Generated restaurant reviews directly open the relevant Google Maps page. This integration automates copy-paste actions, significantly improving UX. Reviews auto-copied to clipboard can be shared on Maps with one tap.

6Custom Routing Systems

The hotel support chat uses a custom translation routing system. Different AI models activate based on user language preferences. This system optimizes both performance and accuracy in real-time translations while reducing costs.

7Firebase AI Logic SDK

Firebase's AI solutions provide powerful tools for Android developers. GenerativeBackend.googleAI() configures cloud models, while OnDeviceConfig sets up on-device models. System instructions and tool lists can be dynamically customized.

8Performance-Cost Balance

Hybrid inference improves app performance while reducing operational costs. On-device models decrease latency, cloud models handle complex queries. This balance is crucial for optimizing user experience.

9Future of Smart Apps

Cloud and hybrid AI features are shaping Android apps' future. These technologies offering personalized, contextual and interactive experiences are setting new standards. Firebase integrations make this transition easier for developers.

Original article: Android Developers Blog — Akıllı Android Uygulamaları İçin Bulut ve Hibrit Yapay Zeka