Android Student
Android Student

Reputation: 153

How to write files from Android to PC and back?

The Situation:
Client has an Android phone that is not activated to use cellular services and his office does not have wifi. He wants me to write him a simple customized contact list that he can view the names and the phone numbers of people(already completed). However, he wants a Desktop Client (done in Java) where he can update the contacts, as he is a bit older and prefers using a standard sized keyboard instead of the slider keyboard on his phone.(this is completed as well).

I need to complete a class for the app that will read a file on the PC's local hard drive and update the contacts file on the SD card.

Options:
As far as I can tell, my only option in this case would be to use the USB port from the phone. I will have the desktop client write the contacts file to the SD card on the Android Device.

Question:
Can I use the USBManager class to have the app:
1. Look for xml contact file on PC.
2. Read the file on the PC and update the file on the SD card.

Additional Information:
Client's Phone Model: Motorola Droid II Global
Android OS version: 2.3.4

Perhaps it may be easier to have the Desktop Client access the SDCard and write the files to the Android Device. I am willing to review all concepts and ideas about this process. Thank you.

Upvotes: 3

Views: 2268

Answers (2)

JSON C11
JSON C11

Reputation: 11800

What about Bluetooth using Androids BluetoothSocket class, on the device? You can purchase USB Bluetooth dongles for PC's if needed. However, Using a USB cable connection would be easier.

Upvotes: 0

Cody Caughlan
Cody Caughlan

Reputation: 32748

If the device is in "Development Mode" you can use the Android Debug Bridge (adb) to push/pull files from a device over a USB connection.

http://developer.android.com/tools/help/adb.html#copyfiles

If the SD card is removable than it sounds like it might be easier to purchase a SD card reader for a PC and have the PC java program write to the SD card, remove it from the PC and then re-insert it into the Android device and then the Android app can read it back from the SD card. Which is what you said in your last paragraph...

Upvotes: 2

Related Questions