-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After upgrading to version 1.0.0 package stopped working on Android #115
Comments
Any errors when you run |
Hey, I had the same problem, camera didn't want to open and not have any logs from logcat. I figure out that before using the camera you need to ask for permission so before your code do:
and in method scanDocument you need to put:
And it's working fine with me. I've tested on phisical device. |
@dmarcs I have tried to filter only the warnings and errors during the time I was starting the camera and confirming the taken image, but it is still way too many and tbh, I have no idea which ones are relevant to my problem. Here is what I've got |
Hey @konri, I didn't have any problem with opening the camera. I could get to the point of adjusting the scan lines and securing the picture, but the was no file path returned. I have tried your code but it didn't change anything. Thanks nonetheless! |
Thanks for sharing how you fixed it @konri, but you shouldn't need to ask for camera permissions. It's possible that you're using another plugin that requires camera permissions. This plugin by itself doesn't require camera permissions. @aliravn can you please try to create a new React Native project, only install this plugin, and run your code? |
@dmarcs I have created a fresh RN 64 project with nothing but document scanner plugin and the button that starts it The result is the same as described above, no errors in the console, no file path. |
Since your code stops, and doesn't run what's in the catch block I would expect to see a crash in your error logs. I don't see that though. I would recommend switching back to version 0.9.1 of this plugin for now since the only difference between that version and 1.0.0 is that I switched the Android document scanner from the one I created to Android's document scanner. |
New version works fine on a Samsung A53 with Android 14.
|
I confirm that after upgrade from 0.9.1 -> 1.0.0 just stoped working on android. Working just fine on iOS. I tried knori fixing but wasn't doing much. I also try to implement like was implemented in docs but no change. So what is happening in my app after I give permission for camera the app is trying to open camera. For a second a grey screen is appearing and after that a white screen with a puzzle logo with google play colors on top and with this text " Something went wrong please try again later " and there is a button with cancel that is taking me back to app. I can't trace any errors, or anything else. React-Native doesn't throw any error neither js. Tested on Samsung galaxy A21s with android 12 |
Tested on different phone models:
*Document scanner with ML Kit on Android - This are the only devices I have Code I used: import DocumentScanner from 'react-native-document-scanner-plugin';
import { request, PERMISSIONS } from 'react-native-permissions';
onPress={() => {
return requestCameraPermission().then(status => {
if (status !== 'granted') {
console.log('Permission not granted')
return;
}
DocumentScanner.scanDocument({
maxNumDocuments: 1
})
.then(({ scannedImages = [] }) => {
console.log(scannedImages);
if (scannedImages.length > 0) {
// set the img src, so we can view the first scanned image
console.log(scannedImages[0]);
}
})
.catch(e => {
Alert.alert('Error on scan', e.message);
});
});
}}
export const requestCameraPermission = () => {
if (Platform.OS === 'android') return request(PERMISSIONS.ANDROID.CAMERA);
if (Platform.OS === 'ios') return request(PERMISSIONS.IOS.CAMERA);
return Promise.reject('blocked');
}; // package.json
{
"react-native-document-scanner-plugin": "^1.0.0",
"react-native": "0.72.4",
"react-native-permissions": "^4.1.0",
} |
Do you have any plans or is there a chance to still support the method you where using on 0.9.1? Maybe have a prop on the component or as a fallback? you have a great tool here and it would be perfect for what I need but I get a little anxious knowing I'll have to stick with an older version, specially if you say it will only support v1.0 method moving forward BTW thanks for this is amazing |
I would use 0.9.1 for your app. I'd rather keep things simple, and not support it moving forward. |
Hi,
I have upgraded the package to version 1.0.0, but after doing so it stopped working on my Android device. First, after the package update the App completely crashed with this error so I had to fix that. Then after taking a picture and confirming it just returns to the screen before the scanner has started. DocumentScanner.scanDocument() doesn't return anything - no scannedImages, no status, no error - nothing. It doesn't even get to the second log. On iOS however it works as it used to without any noticeable issues.
Code:
App:
"react-native": "0.64.4",
"react-native-document-scanner-plugin": "1.0.0",
Devices:
Samsung A41 Android 12
Samsung A52s Android 14
I don't have much experience with RN development so I am a bit puzzled what I may be doing wrong.
Initially the package worked just fine out-of-the-box. Thanks in advance for your insights!
The text was updated successfully, but these errors were encountered: