If you’re an Android developer trying to implement modern AI options into your app, we just lately launched highly effective new updates: Hybrid inference, a brand new API for Firebase AI Logic to leverage each on-device and Cloud inference, and help for brand spanking new Gemini fashions together with the most recent Nano Banana fashions for picture technology.
Let’s bounce in!
Experiment with hybrid inference
With the brand new Firebase API for hybrid inference, we applied a easy rule-based routing strategy as an preliminary answer to allow you to use each on-device and cloud inference by way of a unified API. We’re planning on offering extra subtle routing capabilities sooner or later.
It permits your app to dynamically change between Gemini Nano operating domestically on the gadget and cloud-hosted Gemini fashions. The on-device execution makes use of ML Equipment’s Immediate API. The cloud inference helps all of the Gemini fashions from Firebase AI Logic in each Vertex AI and the Developer API.
To make use of it, add the firebase-ai-ondevice dependencies to your app together with Firebase AI Logic:
dependencies {
[...]
implementation("com.google.firebase:firebase-ai:17.11.0")
implementation("com.google.firebase:firebase-ai-ondevice:16.0.0-beta01")
}Throughout initialization, you create a GenerativeModel occasion and configure it with particular inference modes, resembling PREFER_ON_DEVICE (falls again to cloud if Gemini Nano isn’t obtainable on the gadget) or PREFER_IN_CLOUD (falls again to on-device inference if offline):
val mannequin = Firebase.ai(backend = GenerativeBackend.googleAI())
.generativeModel(
modelName = "gemini-3.1-flash-lite",
onDeviceConfig = OnDeviceConfig(
mode = InferenceMode.PREFER_ON_DEVICE
)
)
val response = mannequin.generateContent(immediate)The Firebase API for hybrid inference for Android continues to be experimental, and we encourage you to strive it in your app, particularly if you’re already utilizing Firebase AI Logic. Presently, on-device fashions are specialised for single-turn textual content technology primarily based on textual content or single Bitmap picture inputs. Evaluation the limitations for extra particulars.
We simply printed a new pattern within the AI Pattern Catalog leveraging the Firebase API for hybrid; it demonstrates how the Firebase API for hybrid inference can be utilized to generate a evaluate primarily based on a couple of chosen subjects after which translating it into numerous languages. Take a look at the code to see it in motion!
The brand new hybrid inference pattern in motion
Attempt our new fashions
As a part of the brand new Gemini fashions, we have launched two fashions notably useful to Android builders and straightforward to combine in your software by way of the Firebase AI Logic SDK.
Nano Banana
Final yr we launched Nano Banana, a state-of-the-art picture technology mannequin. And some weeks in the past, we launched a few new Nano Banana fashions.
Nano Banana Professional (Gemini 3 Professional Picture) is designed for skilled asset manufacturing and might render high-fidelity textual content, even in a selected font or simulating various kinds of handwriting.
The brand new Nano Banana fashions leverage real-world data and deep reasoning capabilities to generate exact and detailed photos.
We up to date our Magic Selfie pattern (use picture technology to alter the background of your selfie!) to make use of Nano Banana 2. The background segmentation is now dealt with instantly with the picture technology mannequin which makes the implementation simpler and lets Nano Banana 2 improved picture technology capabilities shine. See it in motion right here.
The up to date Magic Selfie pattern makes use of Nano Banana 2 to replace a selfie background
You should utilize it by way of Firebase AI Logic SDK. Learn extra about it within the Android documentation.
Gemini 3.1 Flash-Lite
We additionally launched Gemini 3.1 Flash-Lite, a brand new model of the Gemini Flash-Lite household. The Gemini Flash-Lite fashions have been notably favored by Android builders for its good high quality/latency ratio and low inference price. It’s been utilized by Android builders for numerous use-cases resembling in-app messaging translation or producing a recipe from an image of a dish.
Gemini 3.1 Flash-Lite, at the moment in preview, will allow extra superior use circumstances with latency akin to Gemini 2.5 Flash-Lite. To be taught extra about this mannequin, evaluate the Firebase documentation.
Conclusion
It’s a good time to discover the brand new Hybrid pattern in our catalog to see these capabilities in motion and perceive the advantages of routing between on-device and cloud inference. We additionally encourage you to take a look at our documentation to check the brand new Gemini fashions.

.png)
.gif)