I used Gmedia plugin years ago and it worked well.
It seems the new android has changed to the photo picker, and the apis it used are from AppCompatActivity, is it possible implement the functions in Gmedia plugin?
https://developer.android.com/training/data-storage/shared/photopicker#java
Comments
There is a button where you can select an image from your android.
Gmedia opens the photo picker just fine,
the issue I have is before you could pick an image from any folder but now with new android only the photo folder is accessibleEDIT: I can open any images from any folder just fine
Here is some code (unformatted because of forum code formatting issue):
btnloadtile:addEventListener("clicked", function() -- load external tile
local function mediareceive(e)
if self:isValidTexture(e.path) then
local tempbmp = Bitmap.new(Texture.new(e.path, false))
self.w, self.h = tempbmp:getWidth(), tempbmp:getHeight()
if self.w == self.h and self.w <= 128 then
g_currtexpath = e.path
g_tilesize = self.w
mySavePrefs(g_configfilepath)
self:goToScene("tile")
else
local alertdialogwarnings = AlertDialog.new(
"!!SIZE ERROR!!",
"TILE,
"OK")
alertdialogwarnings:show()
end
mediamanager:removeEventListener(Event.MEDIA_RECEIVE, mediareceive)
end
end
if g_isextrawarnings then
alertdialogextrawarnings:addEventListener(Event.COMPLETE, function(e)
mediamanager:getPicture() -- opens file explorer
mediamanager:addEventListener(Event.MEDIA_RECEIVE, mediareceive)
end)
alertdialogextrawarnings:show()
else
mediamanager:getPicture() -- opens file explorer
mediamanager:addEventListener(Event.MEDIA_RECEIVE, mediareceive)
end
end)
This is Gideros 2024.11.1
The plugin I used was very very old, I updated to the new one, it always failed to request the permission, I removed it changed the function like this
public static void getPicture() { // OK
getPictureFunction();
}
Although it does not use the photo picker as google suggested, it works now.
But I still can not get the take a photo from camera function work.
I can take a picture but it won't show up in my app.
The difference now is you need to click ok to validate the picture you have taken.
This part in gmedia needs to be revisited in Gideros. I will try to have a look but no promise at all from me
Here is the original wiki example https://wiki.gideros.rocks/index.php/Media_Plugin
It works well on my phone with android os LineageOS 21, but it maybe failed on some devices. Here is my code.
the steps to take full image using FileProvider
https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed
It works well on my phone with android os LineageOS 21, but it maybe failed on some devices. Here is my code.
the steps to take full image using FileProvider
https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed
It works well on my phone with android os LineageOS 21, but it maybe failed on some devices. Here is my code.
the steps to take full image using FileProvider
https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed
It works well on my phone with android os LineageOS 21, but it maybe failed on some devices. Here is my code.
the steps to take full image using FileProvider
https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed
It works well on my phone with android os LineageOS 21, but it maybe failed on some devices. Here is my code.
the steps to take full image using FileProvider
https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed
here is the code.
Likes: pie
It's a bug of engine.
Likes: MoKaLux, pie
Some breaking changes happened with android 11 and up, for example the app folder has either been removed or is now encrypted. I may be able to save to android pictures folder?
Doing some more tests tinkering with some gideros java files and android studio
- my results are here: https://wiki.gideros.rocks/index.php/CPlusPlus_for_Gideros_Studio_Help#CANNOT_ACCESS_android.2Fdata.2Fpackagename.2Ffiles.2F_on_Android_29.2B
So Android 29+ implements new granular file access with a set of new permissions which are not yet implemented in Gideros:
- android.permission.READ_MEDIA_IMAGES
- android.permission.READ_MEDIA_VIDEO
- android.permission.READ_MEDIA_VISUAL_USER_SELECTED
thus accessing external files is not possible targeting android 29+.
What works:
- mediamanager:isCameraAvailable
- mediamanager:postPicture
- mediamanager:takePicture (kind of)
What doesn't work:
- mediamanager:getPicture
- mediamanager:playVideo
- mediamanager:takeScreenshot
In order to use latest Android privacy stuff we need to add the new PickVisualMediaRequest to GiderosApplication.java but this is out of my league