You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(android): implement native camera permission callback with PermissionListener
Implement proper permission callback using PermissionListener and
PermissionAwareActivity for Android. Promise now resolves based on actual
user response (grant/deny) instead of immediately returning false.
Changes:
- Add PermissionListener callback to handle permission results
- Use PermissionAwareActivity for proper permission flow
- Remove react-native-permissions from example app
- Update example to use built-in permission methods
- Add comprehensive permission documentation to README
- Add proper cleanup to prevent memory leaks
Achieves feature parity with iOS. Compatible with React Native 0.81+
and Android API 23+. No breaking changes.
**Returns:**`Promise<boolean>` - `true` if user grants permission, `false` if denied
272
+
273
+
**Platform Support:**
274
+
- ✅ **iOS**: Fully supported with native callback
275
+
- ✅ **Android**: Fully supported with native callback (API 23+)
276
+
277
+
**Note:** This method shows the native system permission dialog and waits for the user's response, then resolves the promise based on their choice.
278
+
279
+
---
280
+
243
281
### `CameraView`
244
282
245
283
React component that renders the camera preview.
@@ -303,9 +341,99 @@ useEffect(() => {
303
341
304
342
### Permission Handling
305
343
306
-
> **⚠️ Important:** We **strongly recommend** using [`react-native-permissions`](https://github.com/zoontek/react-native-permissions) for handling camera permissions in production apps. This provides better UX, more control, and unified API across platforms.
344
+
The library now provides **built-in native camera permission methods** that work seamlessly on both iOS and Android with proper promise resolution based on user response.
345
+
346
+
#### ✅ Using Built-in Permission Methods (Recommended)
347
+
348
+
The library includes native methods that handle camera permissions with proper callbacks:
- ✅ **Cross-platform**: Works on both iOS (API 10+) and Android (API 23+)
430
+
- ✅ **Promise-based**: Returns `true` when granted, `false` when denied
431
+
- ✅ **Native callbacks**: Waits for actual user response from system dialog
432
+
- ✅ **No dependencies**: No need for additional permission libraries
433
+
434
+
#### Alternative: Using react-native-permissions
435
+
436
+
For more advanced permission handling (checking settings, handling blocked state, etc.), you can use [`react-native-permissions`](https://github.com/zoontek/react-native-permissions):
We're constantly working to improve this library. Here are some planned enhancements:
470
604
605
+
### Recently Completed ✅
606
+
607
+
-[x]**Enhanced Permission Handling** - ✅ Implemented proper native permission callback mechanism for `requestCameraPermission()` method with promise resolution based on user response (iOS & Android API 23+)
608
+
471
609
### Planned Features
472
610
473
-
-[ ]**Enhanced Permission Handling** - Implement proper native permission callback mechanism for `requestCameraPermission()` method with promise resolution based on user response
474
611
-[ ]**Barcode Generation** - Add ability to generate barcodes/QR codes
475
612
-[ ]**Image Analysis** - Support scanning barcodes from gallery images
476
613
-[ ]**Advanced Camera Controls** - Zoom, focus, and exposure controls
477
614
478
-
### Known Limitations
479
-
480
-
-**Permission Handling**: The built-in `requestCameraPermission()` currently triggers the system dialog but doesn't wait for user response. We recommend using `react-native-permissions` for production apps. A proper implementation with permission callbacks is planned for a future release.
0 commit comments