Build intelligent Android apps... Note

Build intelligent Android apps: On-device inference

This blog post series focuses on building intelligent Android applications using on-device AI. The demo app, Jetpacker, will be enhanced with personalized features. This installment explores the use of Gemini Nano via ML Kit's Prompt API for on-device functionalities.On-device processing offers advantages like enhanced user privacy, offline reliability, and cost savings. Three features were identified for Jetpacker: summarizing trip itineraries, managing expenses, and capturing voice notes. Itinerary summarization helps users by transforming detailed schedules into concise overviews with preparation tips. This is ideal for on-device models due to short text inputs/outputs and scalability.Gemini Nano, Google's efficient mobile-optimized model, powers these features. ML Kit's Prompt API allows easy integration and prototyping. Expense management is another key area where on-device processing ensures sensitive receipt data remains private. Gemini Nano's multimodal capabilities aid in extracting information from receipt images.The Structured Output API further streamlines parsing receipt data into defined Kotlin objects. Finally, a voice notes feature uses ML Kit's Speech Recognition API for on-device transcription. This transcribed text is then processed by the Prompt API to identify relevant trip activities. This approach enables efficient, private, and reliable intelligent features within the Android app.