Use model adapters that respect device support and privacy.
1. On-device adapter
The Android runtime supports integration with ML Kit-based local inference. Check the selected API and device capabilities before constructing a usable feature.
2. Cloud boundary
Do not ship privileged model keys in an APK. Use a protected backend or supported Firebase route and preserve user authorization at the application service.
3. Routing policy
A local failure does not automatically authorize a cloud request. Define local-only, cloud-allowed and unavailable behavior for each task and communicate transitions.
Worked scenario
A private note cannot be summarized locally on an unsupported device. The assistant offers manual editing instead of silently uploading it.
Apply it
Implement a capability-driven adapter selector and test local unavailable, cloud disallowed and offline cases.
Check your understanding
The model route follows the user’s data policy under every fallback. Explain the decision and show evidence from your implementation or design. If you cannot demonstrate it yet, revisit the relevant section before continuing.