How does the manifest affect an Android app with an optional camera feature?
Instruction: A receipt app supports in-app camera scanning and file import. Explain the manifest’s role, how the app can remain available on devices without a camera, and why declaring CAMERA alone does not enable scanning.
Updated
Official answer
The packaged manifest describes the app to the system before its code runs: components and their entry points, requested permissions, feature requirements and application metadata. The build merges app, variant and library manifests, so the final artifact is the authority for review.
For this receipt app, declare the in-app camera capability as optional with the camera uses-feature entry's required value set to false, and examine related camera/autofocus feature requirements. Google Play uses declared and some permission-implied requirements to filter eligible devices. An optional feature declaration supports distribution to devices without it; code must still detect availability and offer file import. Device/store distribution rules differ, so do not treat every feature declaration as an installation guarantee everywhere.
If directly using the camera, declare CAMERA and request its runtime grant where required, at the user's scan action. A manifest entry alone grants neither runtime consent nor usable camera hardware. If access is denied or unavailable, keep file import usable. Delegating capture to another app has a different permission/API contract and should be evaluated separately.
Declare Activities, Services, Providers and manifest receivers that need them, with deliberate exported/access settings. Dynamically registered receivers are not all listed there. Intent filters describe matching, not trust; validate external inputs.
Verify the merged release manifest and test camera-present/granted, denied and camera-absent cases. Also check namespace versus applicationId in the build: the packaged identity is not inferred solely from a source-code package name.
Manifest declarations, Feature declaration/filtering, Runtime permissions