OpenDialog Can "See" The Pics on My Android Phone But Can't "Access" Them

I’m trying to access images stored on my Android phone. I used the simple OpenDialog example of getting a picture.

[code] // get image from phone
Dim jpegType As New FileType
jpegType.Name = “image/jpeg”
jpegType.Extensions = “jpg;jpeg”

Dim f As FolderItem = GetOpenFolderItem(jpegType)
If f is Nil Then
//user cancelled
Return
End if

Canvas1.Backdrop = Picture.Open(f)
If Canvas1.Backdrop Is Nil Then
MsgBox “Nil”
End if[/code]

The OpenDialog window displays the pictures from my phone just fine. Selecting one of the images from the phone’s camera folder places the file name in the appropriate field just fine. BUT when I click OPEN, the result returned is Nil. I can choose any picture from any other location on my hard drive using the same code and everything works fine including placing the image on the canvas as the code calls for.

What am I missing here???

maybe its not mounted as a “drive” that is accessible ?

if you just open Explorer does the Samsung show up there ?

Yep … there it is (Samsung-SM-N920V) in Windows Explorer (BTW using Windows 7 Ultimate OS)

if you select it and try to drag an image from there to the desktop does that work ?
seems to me that if that works Xojo should be able to read it as well

Are-you able to copy a file from Android to Windows ?

Using:
http://documentation.xojo.com/api/files/folderitem.html.CopyTo

If so, you are able to read from Android, but you have troubles while displaying the jpg file. Are-they real jfif files ?

Yep … just dragged an image into Powerpoint and another into Word and yet another to the Desktop. Dragging and dropping works fine.

[quote=470396:@Emile Schwarz]Using:
http://documentation.xojo.com/api/files/folderitem.html.CopyTo [/quote]
Unfortunately, Emile, I’m using Xojo 2016 r1.1 and that command you reference was new with 2019 r2.1

What you see in the explorer is NOT a file system. The device is conected throug the Media Transfer Protocol (MTP)

Windows explorer just comunicates to the device and display the contents. Xojo implementation of FolderItem is limited and doesnt include support for MTP.

So, NO, it cannot be done in pure xojo.

Something just doesn’t make sense here …

Maybe I don’t understand MTP but how come I can access the phone folder with pictures using the “Open” command (using the Open Dialog box) in Photoshop and the picture opens right up in the application? Also, it doesn’t make sense that if Windows Explorer is only “displaying the contents” then how come I can drag an image from the phone to my desktop using Windwos Explorer? I am also able to use the “Insert Picture” function in MS Word and MS Powerpoint and access/insert pictures from the phone folder. Matter of fact, there’s not one application on my computer that doesn’t allow accessing the images in that manner from the phone. Do you mean that they are ALL using MTP??? What are those application “Open Dialog” functions doing that the Xojo OpenDialog function doesn’t?

Photoshop is not made with Xojo

you are not dragging an “actual” image, explorer just transfers the file using MTP in the background. It is like you are saying that downloading a file using http with the browser is the same as coping from the server and and pasting in your pc

Yes

MTP stuff. API Calls. This is like asking why Photoshop can open a SVG and xojo cant.

Thanks Ivan - that was my suspicion about how the phone was exposed as a drive to explorer etc
https://en.wikipedia.org/wiki/Media_Transfer_Protocol#Transparency_to_MTP-unaware_software

Well, if needed we could work on a MTP aware open dialog via plugin…

similar one (the same ?) exists in 2015r1.

In the LR:
FolderItem.CopyFileTo
FolderItem.MoveFileTo

But the trouble seems elswhere…

Well, it’s CERTAINLY needed by me! I’ve got to believe that with something as mundane as browsing for pics on a phone that there would be a number of others who would need that same functionality.

My problem is an immediate one, in that, I have an appointment at Walmart headquarters in Arkansas next Wednesday where I need to demonstrate something that requires the desktop app (Xojo) I’ve developed to access and display images off an Android phone. Obviously, potential customers don’t get much bigger than Walmart … which leads me to ask you, Christian … just how soon could you have such a plug-in?

Tried using latest Xojo release, Android device and Windows 10. It works, opening the selected file as JPEG image…

Let me look into that later…

feedback://showreport?report_id=58771

… Just when I thought I was coming to grips with the constraints of MTP :smiley:
Thank you for trying that, Javier! I have a Surface PRO 6 tablet with Windows 10 on it. I’ll download the latest Xojo release and give it a try. Now, I’m REALLY curious!!!

Emile, thanks for your thoughtfulness and the suggestion. I can see the logic to your thought process there.

Ivan … thanks for being patient with me while I’m coming to grips with MTP. I sincerely appreciate your responses and the “education” you afforded me.

Norman and Christian … as always, you guys rock!

Looks like the plugin may be able to read the file and just provide the data.
May need a new file class there, so you can get the data we have.

This protocol is used to avoid conflicts with the OS and also to save on some patent fees from file systems. As a work around for your demo, maybe you culd find and old enought phone that has mass storage capabilities.

in android just go to USB settings and check if the usb connection mode has the Mass storage mode.