How to find out the external storage location using LAMW lazarus / 43-Android ---------------------------------------------------------------------- maurobio · 2023-06-12 11:17 Dear ALL, How to find out the external storage location (eg., SD card) using LAMW? In Java there is an "Environment.getExternalStorageDirectory()" method, but I could not find any equivalent in LAMW. Thanks! Best regards, ---------------------------------------------------------------------- Mongkey · 2023-06-12 23:12 it depends on of your android version, on 13 your location is on inside your app folder. never try external folder on 13, on 9 or 10 are the most easiest finding external folder. ---------------------------------------------------------------------- maurobio · 2023-06-12 23:20 Hi, @MongKey! I have a device with Android 5.5 and another with Android 10. I would like that my app runs on both, but if this is not possible or too cumbersome, I prefer that it would run on Android 10.  So, how could I find the external storage location on these versions of Android? With best regards, ---------------------------------------------------------------------- Mongkey · 2023-06-12 23:23 Mostly LAMW sample run on 10, you could try LAMW on folder-ing sample. ---------------------------------------------------------------------- maurobio · 2023-06-12 23:27 Hi, @MongKey! I am not looking for LAMW demos, I have already tried most of them. What I am asking is if there exists in LAMW an equivalent of the Java method "Environment.getExternalStorageDirectory()" to find out the location of the external storage in an Android device. Best regards, ---------------------------------------------------------------------- Mongkey · 2023-06-12 23:32 if your need just like that, look out pure java folder  implementation: oldies: https://github.com/hungnguyenmanh82/Android_FileReadWrite/tree/master/ app/src/main/java/com/hung/file newest: https://github.com/TeamAmaze/AmazeFileManager ---------------------------------------------------------------------- maurobio · 2023-06-12 23:43 Hi, @MongKey! I am not interested in Java either. For Java there are plenty of fine examples in Stackoverflow and other sites. I want to do it with LAMW! Will keep looking... Thanks a lot! ---------------------------------------------------------------------- Mongkey · 2023-06-12 23:51 if you understand LAMW a lot you'll find java has a lot sample for LAMW implementation, for me LAMW just a set of tools for interpreting java into pascal code --> this one is great for person with only pascal and want to play android with native capability, if you want master a lot LAMW, you must understand JAVA a lot  , Take a look at smart designer folder on LAMW source, it contain a lot java file that used by LAMW to interact with native android. ---------------------------------------------------------------------- maurobio · 2023-06-13 00:02 Hi, @MongKey! QuoteQuoteif you want master a lot LAMW, you must understand JAVA a lot In this case, I would need not waste my scarce time and resources attempting to develop in LAMW, I would just do directly in Java and that would be the end of it. Android development in Java is at least much more well-documented and understood (so it seems) than LAMW. Thanks for your time. Best regards, ---------------------------------------------------------------------- Mongkey · 2023-06-13 00:27 bro, sometimes you need to hack the file, LAMW just provide what common used function, that is why java knowledge is needed  . ---------------------------------------------------------------------- Insid3Code · 2023-06-13 15:07 GetEnvironmentDirectoryPath(dirSdCard); Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //dirDocuments,  //only for API >= 19!!!!   TEnvDirectory = (dirDownloads,                    dirDCIM,                    dirMusic,                    dirPictures,                    dirNotifications,                    dirMovies,                    dirPodcasts,                    dirRingtones,                    dirSdCard,                    dirInternalAppStorage,                  dirDatabase,                    dirSharedPrefs,                    dirCache,                    dirDocuments); //warning: if Device Api < 19 then return dirDownloads!       GetFilePath(fpathExt); Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TEnvPath    = record                 App         : string;    // /data/app/com.xxxx.apk                 Dat         : string;    // /data/data/com.xxxxxx/files                 Ext         : string;    // /storage/emulated/0                 DCIM        : string;    // /storage/emulated/0/DCIM                 DataBase    : string;   end;   TFilePath = (fpathNone, fpathApp, fpathData, fpathExt, fpathDCIM, fpathDataBase); ---------------------------------------------------------------------- maurobio · 2023-06-13 18:43 Hi, @MongKey! Quotebro, sometimes you need to hack the file, LAMW just provide what common used function, that is why java knowledge is needed I do understand. I have never need to hack the LAMW code, but surely I had need to resort to working Java code in order to see how something (usually quite simple) is done. But despite its (too many) shortcomings (weak support and no documentation), I do believe LAMW can be a great tool for developing Android apps (or at least simple apps, as are those I develop) in a language that I know and love (that is Pascal!). With best regards, ---------------------------------------------------------------------- maurobio · 2023-06-13 18:48 Hi, @Insid3Code! Welcome!!! Very helpful!!!! Thank you very much!!!  Since you seem very knowledgeable about LAMW, mind if I explain why am I interested in the location of external storage? Perhaps you and @MongKey can help me to crack a very though nut! Thanks in advance! With warmest regards, ---------------------------------------------------------------------- maurobio · 2023-06-13 22:02 Hi, I found something which looks strange. Here are the values of the variables "dirInternalAppStorage" and "dirSdCard" on my device running Android 10: QuotedirInternalAppStorage = '/storage/emulated/0/Download' dirSdCard = '/storage/emulated/0' I don't understand this; why is the internal storage directory basically identical to the external SD card? What if a device has no SD card (I have yet not tested this on another device which does not have a card)? Any hints? With best regards, ---------------------------------------------------------------------- jmpessoa · 2023-06-14 20:51 QuoteIn Java there is an "Environment.getExternalStorageDirectory()" method, but I could not find any equivalent in LAMW. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  ShowMessage(Self.GetEnvironmentDirectoryPath(dirInternalAppStorage));  //but de "raw" info change device by device.... ---------------------------------------------------------------------- maurobio · 2023-06-18 13:38 Hi, @jmpessoa... So, in LAWM the dirInternalAppStorage is equivalent to dirExternalAppStorage in Java?  Very strange, to say the least... ---------------------------------------------------------------------- jmpessoa · 2023-06-19 17:37 No. Sorry.... LAMW use  the java API  "Environment.getExternalStorageDirectory()" to get the sdcard path.... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  ShowMessage(Self.GetEnvironmentDirectoryPath(dirSdCard));