Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Access to USB flash drive on Android

Author
Message
Albatros
9
Years of Service
User Offline
Joined: 2nd Oct 2015
Location:
Posted: 22nd Aug 2024 12:48
Hello everyone!

There was an urgent need to read the connected USB flash drive on a device with the Android 12 operating system.

We can read the contents of the folder using the OpenRawFolder() command, but there is a problem:

We can read the contents of the flash drive only if we know the volume label (folder name XXXX-XXXX)
"/storage/XXXX-XXXX"
"/mnt/media_rw/XXXX-XXXX"
"/mnt/user/0/XXXX-XXXX"

But we cannot know the volume label in advance, because different flash drives will be connected to the device.

There is no access to the "/storage/", "/mnt/media_rw/", "/mnt/user/0/" directory.

The "WriteExternal" permission does not help on Android 12.

I tried editing the application manifest file and adding different permissions like MANAGE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE, but it does not work ((

Is there any way to find out the flash drive volume label using standard Tier 1 methods?
TheWanted
1
Years of Service
User Offline
Joined: 17th Oct 2023
Location:
Posted: 22nd Aug 2024 18:02 Edited at: 22nd Aug 2024 18:17
https://forum.thegamecreators.com/thread/219478#msg2601732

Maybe might be a command in there

String GetSystemDriveInformation(String Drive, Integer InfoType)
InfoType(0) = Serial
InfoType(1) = Component Length (max number of chars between backslashes)
InfoType(2) = File-System (FAT, NTFS, ...)
InfoType(3) = Volume Name
Yeshu777
5
Years of Service
User Offline
Joined: 26th Feb 2020
Location: Cardiff ( Caerdydd ), Wales ( Cymru ), UK
Posted: 23rd Aug 2024 00:19
Have you looked into libusb?

Yeshu777
Albatros
9
Years of Service
User Offline
Joined: 2nd Oct 2015
Location:
Posted: 23rd Aug 2024 14:33
TheWanted, thanks, but this is a plugin for Windows, and the flash drive needs to be read for Android...

Yeshu777, how to use this? Is this some kind of library for Android? I work at level Tier 1.
TheWanted
1
Years of Service
User Offline
Joined: 17th Oct 2023
Location:
Posted: 24th Aug 2024 10:37 Edited at: 24th Aug 2024 10:37
Ah that's a shame, I usually write agk plugins for both windows and android, shame madbit plugin doesn't support android. I will try libusb see what I can get to work
Yeshu777
5
Years of Service
User Offline
Joined: 26th Feb 2020
Location: Cardiff ( Caerdydd ), Wales ( Cymru ), UK
Posted: 25th Aug 2024 03:06 Edited at: 25th Aug 2024 03:14
Hi,

On the git-hub repository for libusb there is already an Android version

https://github.com/libusb/libusb/tree/master



@Albatros

Regarding Tier 1 etc..

Using libusb to create a PlugIn should be fairly straight forward - and Tier 1 works with PlugIns.



Yeshu777

Attachments

Login to view attachments
Albatros
9
Years of Service
User Offline
Joined: 2nd Oct 2015
Location:
Posted: 25th Aug 2024 19:28
Thank you, I will look into this!

Login to post a reply

Server time is: 2025-05-14 16:46:17
Your offset time is: 2025-05-14 16:46:17