{"id":19335052,"url":"https://github.com/akshar062/composecamera2api","last_synced_at":"2025-02-24T07:42:15.640Z","repository":{"id":261733340,"uuid":"885166119","full_name":"Akshar062/ComposeCamera2Api","owner":"Akshar062","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-12T03:58:53.000Z","size":107,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-06T09:45:06.468Z","etag":null,"topics":["android","camera2-api","jetpack-compose","kotlin","mobile-app"],"latest_commit_sha":null,"homepage":"https://medium.com/@axar2324/building-a-simple-camera2-api-app-with-jetpack-compose-fe5ac72f48be","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Akshar062.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-08T04:38:01.000Z","updated_at":"2024-11-23T21:54:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"b24a76da-e54e-4732-a0fe-e384470983fb","html_url":"https://github.com/Akshar062/ComposeCamera2Api","commit_stats":null,"previous_names":["akshar062/composecamera2api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akshar062%2FComposeCamera2Api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akshar062%2FComposeCamera2Api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akshar062%2FComposeCamera2Api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akshar062%2FComposeCamera2Api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Akshar062","download_url":"https://codeload.github.com/Akshar062/ComposeCamera2Api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240441816,"owners_count":19801790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","camera2-api","jetpack-compose","kotlin","mobile-app"],"created_at":"2024-11-10T03:04:43.324Z","updated_at":"2025-02-24T07:42:15.621Z","avatar_url":"https://github.com/Akshar062.png","language":"Kotlin","readme":"# ComposeCamera2API\n\nA sample Android application demonstrating the integration of Camera2 API in a Jetpack Compose application. This app displays a camera preview using Camera2 and handles camera permission requests dynamically in a modern, Compose-first UI.\n\n## Features\n\n- Uses **Camera2 API** to display a live camera preview.\n- Integrates with **Jetpack Compose** for building UI.\n- Dynamically handles **camera permission requests**.\n- Provides an informative message when the camera permission is not granted, allowing the user to re-request permission.\n\n## Screenshots\n\n| Camera Permission Not Granted  | Camera Preview  |\n|--------------------------------|-----------------|\n| \u003cimg src=\"path/to/permission_screenshot.png\" width=\"200\"\u003e | \u003cimg src=\"path/to/preview_screenshot.png\" width=\"200\"\u003e |\n\n## Getting Started\n\n### Prerequisites\n\n- Android Studio Flamingo or later\n- Android SDK 21 (Lollipop) or higher\n\n### Installation\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/Akshar062/ComposeCamera2Api.git\n   cd ComposeCamera2API\n\n2. **Open the project in Android Studio:**\n\n  - Select File \u003e Open... and navigate to the project directory.\n  - Sync Gradle if prompted.\n  \n3. **Run the app on an emulator or a real device with Camera2 API support** (most modern devices support this).\n\n### Usage\n\n- When you first open the app, it will request permission to access the camera.\n- If permission is granted, the app will display the live camera feed.\n- If permission is denied, a message will prompt you to click and re-request camera permission.\n\n## Code Overview\n\n## Main Components\n\n- **MainActivity.kt:** Contains the core logic for requesting camera permission and displaying the camera preview.\n- **CameraPreview.kt:** A composable function that initializes and handles the Camera2 API preview within a TextureView.\n- **Permission Handling:** Uses ActivityResultContracts.RequestPermission to handle dynamic camera permission requests in a Compose-friendly way.\n  \n## Key Files\n\n- MainActivity.kt: Contains the main activity, handles permissions, and integrates the camera preview composable.\n- CameraPreview.kt: Defines the CameraPreview composable function using TextureView and sets up the Camera2 session.\n\n## Important Permissions\n\nMake sure to add the following permission to AndroidManifest.xml to allow camera access:\n   ```bash\n   \u003cuses-permission android:name=\"android.permission.CAMERA\" /\u003e\n   ```\n\n## Troubleshooting\n\n- Camera Not Showing: Ensure the device supports Camera2 API. Most devices running Android 5.0 (Lollipop) and above support it.\n- Permission Denied: If you deny the camera permission and want to grant it later, go to device Settings \u003e Apps \u003e ComposeCamera2API \u003e Permissions and enable the Camera permission manually.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Acknowledgments\n\nThis project demonstrates basic usage of:\n\n- [Jetpack Compose](https://developer.android.com/compose) for UI\n- [Camera2 API](https://developer.android.com/reference/android/hardware/camera2/package-summary) for camera functionality\n\n\nThank you for checking out this project! Feel free to reach out for any questions or suggestions.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshar062%2Fcomposecamera2api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshar062%2Fcomposecamera2api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshar062%2Fcomposecamera2api/lists"}