Installed expo-image-picker, calling launchImageLibraryAsync. This works completely fine on Emulator.
On a real android device (Samsung A3, API 24), and picking images from the Library, I sometimes get an error Uri lacks 'file' scheme: content://com.android.provider.media.documents/documents/<imagename..>.
My understanding is that it's images which have been saved NOT by the device camera, e.g. whatsapp, other apps using the camera. Images which were taken on the device camera work OK and have a local path.
Is there a known way to deal with this? I can't seem to stop the user seeing/picking these images, and can't pass in any options to ignore this error (or fail gracefully if multiple images are selected and only 1 fails). Currently we just catch and give a generic error which is a bit mmm.
Related
I just started working with ML5 and machine learning in general. I started by creating an app that classifies images from my webcam using 'MobileNet' image classifier, I then created a my own classifier using Teachable Machine which also worked great. I created my app using cordova, and I used the browser platform as I got started and all worked great.
However once I switched to try the app on android platform, whatever image I try to classify (whether it is taken with my phone camera, or even hard-coded to the html page) always returns the same result with the exact same confidence. But if I switch back to the browser, it works just fine again. I cant seem to find anyone else reporting this kind of problem. Does anyone have any idea what it might be?
I once had the same problem and it turned out that the Android version was having out-of-memory exceptions that weren't being caught or reported.
After debugging using Chrome Developer Tools (by following this), it appears the problem was that the images I was trying to classify were too large to be processed on android (error - webGL: INVALID_VALUE: texImage2D: width or height out of range).
Therefore reducing the size/quality of the images before classifying them resolved the problem.
I tried this. Perfect work on almost devices.
But doesn't work at Samsung Galaxy 3.
On normal device i have something like content://media/external/images/media/1 in intent.getData() and after using getContentResolver() i have /mnt/sdcard/Android/data/package/.../file.jpg
But on Samsung Galaxy 3 in intent.getData() i have content://com.sec.android.gallery3d.provider/picasa/item/5624862738518543714 and https://lh5.googleusercontent.com/-22xcQIWrlT4/Tg-G29-6jWI/AAAAAAAAAJA/i_FUO3pN1Sc/I/%2525D0%252597%2525D0%2525B0_%2525D0%2525B5%2525D0%2525B4%2525D1%252583.jpg after using Resolver.
What should i do to get normal path on Samsung Galaxy 3?
UPD: i see, in gallery there is available to pick pictures from my Google+ shared pictures. Hm...
So, i think, i will show message for users in this case to pick only local files.
I just want to ask if there is now a workaround to solve the file upload problem in Android when there's not enough RAM after file selection.
Look at these URLs:
Android browser refreshes page after selecting file via input element
http://code.google.com/p/android/issues/detail?id=53088
https://github.com/kostysh/File-uploading-component-for-Sencha-Touch/issues/5
My smart phone Samsung Galaxy xcover has 37,70 MB RAM.
When I click a standard HTML file upload control on a web page and select a file (from gallery, camera, camcorder etc.) Android kills the browser instance to get some free RAM, then Android starts the browser again and refreshes the web page.
I think there must be a technical solution some day ...
Has anybody new information about this problem?
Thomas
I have code that gives me back a path to store my video file which basically produces a path that looks like this:
/storage/sdcard0/Pictures/MyApp/MyApp20130816_144111_1131938614.mp4
When I try to capture the video on my S2, I take the video and press stop the camera my camera app does not display the normal save screen, it just puts itself back into the beginning of capture mode and onActivityResult is never called. I've found that if I do not pass a path to MediaStore.EXTRA_OUTPUT it functions correctly.
I've tested my code on Note II, GS3, GS4, Nexus and they all seem to be able to capture the video and save it to the correct path with no problems. Why would the S2 be behaving this way?
Something about the galaxy s2 doesn't like /storage/ maybe?
Never hardcode paths. Always use methods like Environment.getExternalStoragePublicDirectory() to get the root of where to store files on external storage. Different devices, and even different users on the same device (Android 4.2+ tablets) will have different paths for external storage.
However, the point in my initial comment still holds. You as a developer are not "using the default camera app as installed on the galaxy devices". You as a user may be using that particular app. There are nearly a billion Android device users; you are not all of them. They are welcome to use whatever camera app they want to, including third-party ones. And, they will be using thousands of Android device models. None of them will necessarily honor your request to take a picture. It's certainly worthwhile for you to do testing to try to work more faithfully on more devices (such as not hardcoding paths), but you need to bear in mind that any time you ask another developer's app to do work for you, the other developer is control of what happens, much more than you are.
I have an app that displays an an image in an ImageView using the setImageDrawable(Drawable) method. However, with the release of the Droid Incredible the images are coming up as a blank screen. I am using Drawable.createFromPath(Environment.getExternalStorageDirectory() + "\\imagefile") to access the image from the SD card. I don't get any sort of error, just a black screen. I will get a null pointer exception if after trying to load the image I try to access a property of the Drawable. This makes me believe that the Drawable wasn't loaded, but I don't know why or how to make it work.
This code as been working on all other Android devices, so I'm not sure what is different with the Incredible.
Unfortunately I don't have access to an Incredible to test on, so I've got to rely on others to test and send me the log files. Any help you can offer would be greatly appreciated. If anyone knows how to replicate this issue on the emulator, that would be helpful too. I've configured an emulator with firmware 7 and the correct screen resolution, but I was unable to replicate the issue.
The Incredible does not come with an SD card. Instead, it has 8GB internal storage you can work with. See here for more information.
Heh, I just noticed Mark already said this.
I've verified that it's not an issue with the SD card (although that is another issue to be addressed). Using an Incredible with an SD card installed produces the result described above as does saving/loading the image from the internal memory ("/emmc").