Skip to content
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

issue with getting the correct path/filename back #18

Open
isaacbdawson opened this issue Nov 20, 2020 · 5 comments
Open

issue with getting the correct path/filename back #18

isaacbdawson opened this issue Nov 20, 2020 · 5 comments

Comments

@isaacbdawson
Copy link

isaacbdawson commented Nov 20, 2020

I am having an issue with getting the correct path/filename back.

The plugin is returning:
file:///external/images/media/12035

however I find the file itself physically on the device here:
/storage/emulated/0/Pictures/c2i_1605857769374.png

the project is using
cordova android@9 with a target sdk of 29
the device is running Android 10

any help in resolving this would be greatly appreciated!

edit: it seems this might be (at least partially) related to Android 10 scoped storage?
my camera plugin stores images like this:
file:///storage/emulated/0/Android/data/com.appname.here/cache/1605859328822.jpg
and those work fine.

@rodrigograca31
Copy link
Owner

I've seen all those types of paths....
This is the line that returns it:

callbackContext.success(imageUri.getPath());

Also not sure if you ommited some numbers or System.currentTimeMillis() on your phone returns only "160585" 🤔🤔🤔
That could explain some problems I've had on my app.....

@rodrigograca31
Copy link
Owner

Feel free to play with the returned value but not sure I will be able to accept a PR as changing that is a big change.

@isaacbdawson
Copy link
Author

Apologies, I edited the original comment, it was late and I must have accidentally cut off the file name of the png.

For clarification.

The issue is not just the path it returns (which appears to be wrong), but where it is actually storing it.
As from my limited research it appears even if it did somehow return the correct path, under Android 10 it wouldn't be accessible to the app itself due to scoped storage.

I guess there is a scenario where all you might need the plugin for is saving the canvas to an image somewhere on the device, and that is it... but I would think most use cases of such a plugin involve actually addressing the image in some manner.

@rodrigograca31
Copy link
Owner

yeah, unfortunately, I don't have enough Android knowledge to be able to fix it in a way that it stores correctly and returns a usable path. 😢

@rodrigograca31
Copy link
Owner

please feel free to send a PR or open a bounty for someone to do it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants