Syncing to Desktop, file transfer from Device to Desktop

krsrn

Member
Licensed User
Longtime User
I currently have an application written in .NET which detects when a device is plugged into a desktop. Using Active sync this application will run my .NET application to pass a file to the device and also retrieve a file from the device before terminating.

Is this possible within Basic 4 Android?

I have looked at the Network tutorial as this looks similar to what I am trying to achieve, however, the desktop application found in the example fails to connect.

Any ideas?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Android doesn't have a built-in feature such as Activesync. You will need to implement the updates yourself.
There are several ways to do it. One solution is with a TCP/IP connection (network library). This will work if you have a local wireless network. You may want to check B4A-Server for such a task.

Another option which should be simpler to implement is to run an FTP server on your desktop and download the file with the Net library (again it requires a local network).

A third solution is to send the updates to a mail account and then download the files using POP3 (Net library).
 
Upvote 0

krsrn

Member
Licensed User
Longtime User
Ok.

Is there anyway to do the Updates without any Email/Web interaction. I say this as wireless and email are not used outside of the development area.

I currently have a it set up based on an example currently on the site which will pass a file to the device. However, this is done wirelessly. Is this possible to achieve just by the usb connection? Changing router settings/port forwarding is not possible. The solution I am looking for needs to be as simple as plug and play without any specialist knowledge as that would mean going backwards from what we currently have written in windows mobile.
 
Upvote 0

krsrn

Member
Licensed User
Longtime User
Any help appreciated please? As if Basic4Android cannot achieve this I may have to look else where as it seems we will have gone backwards in our development plans.
 
Upvote 0

dbcrosby

Member
Licensed User
Longtime User
I too have a need for a service/program code that would sync to a folder on the desktop computer. I cannot have anything extra running on the desktop computer. I need it to attach the android through the wireless router. The android device then needs to be able to pull the file from the desktop computer.
What service would work best for this?
FTP?
SMB (samba)?

Help please!

Thank you!
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
@krsrn

When you connect an android device to a pc via usb, you can tell it to allow access as a disk drive. If you can get your users to do this, then everything else could be done via your .NET app.

i.e.:

Detect usb device, check update required, copy files etc?

I know it's not seamless, but it should be simple for the user.

Edit more info: Apparently some devices allow auto mounting, and if your users phones don't, I have read that there are apps available to do it. May help.
 
Last edited:
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
You could use adb commands to connect to it to install things i think.
Maybe create an autorun batch file in the android filesystem.
I do find it a bit annoying connecting an android device to a computer via USB since you have to select to turn on the usb mass storage. (The first time it took me a couple of hours to figure it out and i was so dissapointed that i can use it as a mass storage device )
 
Upvote 0

krsrn

Member
Licensed User
Longtime User
I have managed to implement a syncing program within .NET to place a file within the external directory. Upon connecting to the .NET program the device will switch to a mounted USB drive.

However, I have a timer monitoring the external directory for a few files but upon running my .NET program to fails to read this directory. If I switch back to charge the device only. The directory is found and the file is read.

Is there a location I read from that will be accessable for reading and writing than can be viewed whilst in USB Charge Only and mounted USB?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…