-
Notifications
You must be signed in to change notification settings - Fork 280
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
Crashes when loaded from another app #33
Comments
Hi @rugk , I've tested with telegram and didn't happened any error, can you confirm you are working on last version? What is the app you are using to call Open Note Scanner from? Best regards, |
I also tested it with other apps now and I did only get this error with this particular app. I'll report it to them and see what they say. I'm using the latest version available on FDroid. |
F-Droid didn't updated to 1.0.23 yet. If the app you are having problem with is available, I can try to reproduce the error here. |
Okay, the app is Threema. Here's how they call an external camera: Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraUri);
startActivityForResult(cameraIntent, ID_PICK_CAMERA); |
Well, it is a paid app, so I can not test. Looks there is nothing wrong with the calling code. But everything that involve paths have differences between android versions also. If you are a developer, you can help me tracking this down debugging the app on OpenNoteScannerActivity.java line 899 ... it is the line that saves the file. Anyway, I will try to implement some debug messages there for the next version at least, this will give me more debug information. |
Oops... line 889 |
You could have just linked to that line, but as I am no developer I'm sorry I can't help debugging it. |
OpenNoteScanner (or rather OpenCV) attempts to select the appropriate image writer from looking at the extension of the suggested file name provided by the MediaStore.EXTRA_OUTPUT extra parameter. Apparently, Threema uses a file name that does not include a recognized extension. Hence, OpenCV crashes with: |
So is this the fault of Threema or OpenNoteScanner? |
Evaluating file name extensions of the path component of an URI is not a good way to determine what format the output should be. Or, at least, a default format should be used, if the extension is not recognized. If you want the calling app to be able to choose the format, using ContentValues with a Images.Media.MIME_TYPE parameter might be a better idea. |
@rugk, I do not know yet, it is possible that OpenNoteScanner doesn't handle the call from Threema correctly. @mimiks, OpenNoteScanner for now saves only jpeg files, so, this can be the problem. Will look about the parameter you told for the next release. Please remember folks that I do this on my spare time! :-D |
@mimiks, Now I read your previous message. I was thinking that OpenCV was using always jpg, but, this can be the case also. I will spend some bucks on Threema in order to debug this correctly. @rugk, |
@rugk - Lunch time quick fix... already uploaded to Google Play and releases section |
Thanks for the quick fix. Works well! I really appreciate your efforts. There's one more thing to consider: Some apps may provide an URI that refers to a content provider rather than a file. In that case, the URI scheme starts with content:// rather than file:// and A comprehensive example of how to get the path from file-based content providers can be found here: |
I have another all which allows you to chose "camera" for sharing photos. There you chose the camera so and the camera so sends the picture back to the app for further processing.
However when I choose your app there it always crashes after I take a photo.
Logcat:
The text was updated successfully, but these errors were encountered: