Access to windows folder lazarus / 43-Android ---------------------------------------------------------------------- magleft · 2023-04-22 15:24 In Windows I have created a shared folder with read + write permissions, e.g. //DESKTOP-9ABC8H5/AgrosNet I would like to access the folder via network share from within android. I have read the AppShareFileDemo1 and AppPublicFoldersAccessDemo1 examples but I could not find a solution. I have no knowledge about handling the internet, I can't make the relevant code. Could someone help me, even for a fee? ---------------------------------------------------------------------- KodeZwerg · 2023-04-22 17:07 Normally it is enough to add '\\?\' (without quotes) infront of a UNC path to access its content. ---------------------------------------------------------------------- magleft · 2023-04-23 10:09 First of all I would like to know how I would like the android device to connect to the windows shared folder via wifi. I built the following application, but it can't find the file 'ApkAgros.db' located in the windows shared folder. What am I doing wrong; 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 procedure TAndroidModule1.Button1Click(Sender: TObject);var  apath:String;begin  apath := '\\?\\\DESKTOP-9ABC8H5\AgrosNet\ApkAgros.db' ;  if FileExists(apath) then     showmessage('File Exist')  else      Showmessage('Not Exist');end;  procedure TAndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);var  manifestPermissions: array of string;begin  if IsRuntimePermissionNeed() then   // that is, target API >= 23  - Android 6  begin     SetLength(manifestPermissions, 1);     //hint: if you  get "write" permission then you have "read", too!     //from AndroodManifest.xml     manifestPermissions[0]:= 'android.permission.WRITE_EXTERNAL_STORAGE';     // location     Self.RequestRuntimePermission(manifestPermissions, 701);     //camera     Self.RequestRuntimePermission(manifestPermissions, 802);     //upload     Self.RequestRuntimePermission(['android.permiss ion.READ_EXTERNAL_STORAGE'], 3027);//android.permission.WRITE_EXTERNAL_STORAGE     SetLength(manifestPermissions, 0);     SetLength(manifestPermissions, 3);     manifestPermissions[0]:= 'android.permission.RECEIVE_SMS';  //from AndroodManifest.xml     manifestPermissions[1]:= 'android.permission.SEND_SMS'; //from AndroodManifest.xml     manifestPermissions[2]:= 'android.permission.READ_PHONE_STATE';     Self.RequestRuntimePermission(manifestPermissions, 2001);      SetLength(manifestPermissions, 2);      manifestPermissions[0]:= 'android.permission.CAMERA';  //from AndroodManifest.xml     manifestPermissions[1]:= 'android.permission.WRITE_EXTERNAL_STORAGE'; //from AndroodManifest.xml      Self.RequestRuntimePermission(manifestPermissions, 1101);      SetLength(manifestPermissions, 1);     Self.RequestRuntimePermission(manifestPermissions, 1198);      SetLength(manifestPermissions, 0);  end; end; ---------------------------------------------------------------------- KodeZwerg · 2023-04-23 14:15 Now I understand better, simplest solution would be to put up on windows machine a Tcp/Ip kind of server (http or ftp probably) and access it easy over that protocol. Using the windows share will also need to set up a network share, when that is done you need to use a SMB connection from your application to access that share in your Android device. ---------------------------------------------------------------------- magleft · 2023-04-24 15:55 If I understood correctly, the transfer will be done through a server. I'd rather it not be required or virtual as that means extra cost. I have seen apps on android that can recognize windows shared folder. I don't know if it is possible through laz4android. ---------------------------------------------------------------------- KodeZwerg · 2023-04-24 20:18 Welcome to the world of networking  I do not believe your saying that over Wi-Fi some app is able to get a Windows shared folder. Sound impossible to me but hey, I am here to learn new things aswell. To me are only 2 options possible that not require a server setup, that is direct USB connection or LAN. ---------------------------------------------------------------------- magleft · 2023-04-29 17:22 I think there are several applications. You can see for example the Cx file explorer app from the play store. So it definitely does. The question is how? ---------------------------------------------------------------------- TRon · 2023-04-30 00:05 Quote from: magleft on April 29, 2023, 07:22:05 pmI think there are several applications. You can see for example the Cx file explorer app from the play store. So it definitely does. The question is how? Answered by KodeZwerg Quote from: KodeZwerg on April 23, 2023, 04:15:23 pmNow I understand better, simplest solution would be to put up on windows machine a Tcp/Ip kind of server (http or ftp probably) and access it easy over that protocol. Using the windows share will also need to set up a network share, when that is done you need to use a SMB connection from your application to access that share in your Android device. See for example here for how to setup. You application thus has to use the SMB protocol to discover the share(s) and to transfer data around. Note that SMB is also named SaMBa (it can help you in your search). I doubt that there is a ready to go example for Free Pascal/lamw so you best bet would be so look for example code written with the native android toolkit. edit: jcifs and small example and this one for some basics. ---------------------------------------------------------------------- magleft · 2023-05-01 04:52 Thanks for the help. I will try to find a solution for the smb protocol. I found some help in the forum [url] https://forum.lazarus.freepascal.org/index.php?topic=39149.0 [url] But apparently Android does not support the TProcess class. ---------------------------------------------------------------------- TRon · 2023-05-01 12:03 Quote from: magleft on May 01, 2023, 06:52:09 amThanks for the help. I will try to find a solution for the smb protocol. There is not a real solution but I lack android/lamw knowledge to know how to describe the path that needs to be taken. afaik there are 2 options: 1) install the jcifs library on your andoriod box, write a jni wrapper for it in Pascal 2) re-implement jcifs in fpc/jni and use that And perhaps I got that even wrong. QuoteI found some help in the forum [url] https://forum.lazarus.freepascal.org/index.php?topic=39149.0 [url] But apparently Android does not support the TProcess class. afaict the use of "net use" is a Windows only feature meaning that it will not work on/for Android.