How to access SD Card from .NET program on a PC

Hello all,

We have been running into a few hiccups that I was hoping someone would be able to help us with. We are developing an inventory application on a TC8000 device that requires a SQLITE file to be loaded onto the device from a back office server(Windows 7) and we are having problems figuring out a way to send the file to the device via USB. But first, let me set the stage a bit. The owner of the company needs to have a device at every location and not all locations have wireless AP's. With this being said, we need to find a way to connect the device via USB as wireless is not an option that we have. When we attach the device to the computer, it shows up as a Media Device which means we can not assign it a drive letter and transfer the file within our .NET program. I have done some reading and Android has disabled support as a Mass Storage device in 4.0 apparently. While stumbling through the Profile Manager, I saw a USB section to it and a checkbox for UsbUMSAccessDeviceStorageUsage. Is this something that we can use in order to get the SD card to look like a Mass Storage device? Thank you in advance for any help that you can provide.

Anonymous (not verified)
Hi Patrick, I can't speak

Hi Patrick, I can't speak authoritatively as I do not have a device to test with but the docs for USB imply to me that the device has to first support any functionality being exposed from the USB profile manager.  Did you try it? The characteristic would look something like this:

<characteristic type="UsbMgr" version="4.2"> <parm name="emdk_name" value="USB_test"/> <parm name="UsbModuleUsage" value="1"/> <characteristic type="SelectedAccessDeviceStorageUsage"> <parm name="UsbUMSAccessDeviceStorageUsage" value="1"/> </characteristic> </characteristic>

Since you have to connect the devices to a PC anyway, would it not be easier to use adb?  adb push myfile /storage/sdcardlocation?  I'm not sure which location is the SD card as it can vary between devices but you should be able to push files that way.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Patrick Cromie
Darryn,The whole purpose was

Darryn,

The whole purpose was to keep the communication process enclosed inside of a .NET application. The application would be running on the back office and waiting for the Scanner to be docked. When the scanner is docked, it would then fire an event that would start the communication process to the handheld. I'm not sure of a way to use adb within a .NET application. We would have to fire off a batch file that would start the communication process. Logically, that would not make sense as we would like to perform some testing to make sure that the correct SQLITE file is getting sent to the gun prior to the communication. Alternatively, yesterday I was looking at the TC8000 cradle and noticed an Ethernet port on the back side and was wondering if we could use that instead for the communication. When the Inventory scanner is cradled, we should be able to theoretically PING the device and transfer the file accordingly within the .NET application. Although, if you have any suggestions on how to set a static IP address to the TC8000 programmatically, I would love some suggestions. As for my previous problem, I will mark your answer as the correct answer as that would theoretically provide a way to push files to the device.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
How about having an app on

How about having an app on the device try to download the file from the server when it is docked in the ethernet cradle?  Pull instead of push.  That way you don't need to worry about the IP address of the device.  The app on the devices just need to know the address of the server.  You should be able to use connectivity manager to determine when the device has a connection.

ConnectivityManager | Android Developers

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
I was assuming you would call

I was assuming you would call out to a batch script from your .NET app that would run adb.  I like Dan's idea though, it also avoids the need to use a hard coded path for the SD card since you can use Android's external storage directory methods, Storage Options | Android Developers but that does of course rely on you creating an application to run on the device.  There is not a way to configure a static IP address that I'm aware of but you can configure the host name, Hosts Manager - Zebra Technologies Techdocs (that can be called programmatically on the device but not from a connected server). To push the file to the device, if you are not using ADB then I presume you would need something on the device to receive the file anyway with your described Ethernet technique.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments