amazing developers. I am building an app that would offer opportunity to either take a photo on spot and upload it, or choose an image from gallery. I am using react-native-image-picker
for it. So far, my life was going great and everything ran smoothly on the emulator, however, once I installed the APK file on my android device, pressing the camera button didn't do anything. No errors, no permission request, nothing at all. On emulator I didn't have any errors in console and it worked perfect.
Here is the state:
const [pickerResponse, setPickerResponse] = useState(null);
And buttons with the onPress() functions:
<Button
title='Take A Photo'
color="darkgray"
onPress={() => launchCamera({mediaType: 'photo', saveToPhotos: true}, setPickerResponse)}
/>
<Button
title='Open Gallery'
color="darkgray"
onPress={() => launchImageLibrary({mediaType: 'photo'}, setPickerResponse)}
/>
I am only having this issue with launchCamera
and not with launchImageLibrary
.
I added these permissions:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.camera" />
But they didn't make a difference and instead made my emulator stop working.
It's my first ever react native app so a little push in the right direction would be highly appreciated. Wish you a great weekend.