Copy data from Android to PC


#1

I need to move data (a file) from my android app to a local PC via wifi. Can you please tell me the easiest way to do this. Is there a sample program to show me this?


#2

There are a number of ways to do this. It will depend how your PC is set up.

The normal way to do this would be by Ajax:
http://wiki.nsbasic.com/Ajax_made_Simple


#3

If you just want to transfer files, you can use something like this:
https://play.google.com/store/apps/details?id=com.smarterdroid.wififiletransfer&hl=en
Disclosure: Not my app. Just something I found during a quick google search.

If you want to build one out to sell or give as an android app, you will need to source out networking protocols. That would be beyond the scope of a forum discussion at this point in terms of detailing it out.

In the example given by @AppStudioSupport using Ajax calls, you will need to set up a server that picks up those calls and processes them.


#4

Thanks for the replies.
I need to do this from within my App.
I was hoping I’d be able to connect to a shared folder on the PC and copy a file directly to that folder.
Is this possible?


#5

You can’t do that directly. If it were allowed, then random websites would be allowed to scribble data on your hard drive (a scary thought!)

An alternative would be to write the data to a DropBox folder on the device, which would then be mirrored onto your PC. You’ll need to go through some security steps.

http://wiki.nsbasic.com/Using_Dropbox_to_save_files


#6

I am trying to get an AJAX example running using my own PHP server.

The documentation states:

  1. Set jQuery’s options to allow cross origin requests:
Sub Main()
  'the next two statements should be added to your Sub Main()
  $.support.cors = True
  $.mobile.allowCrossDomainPages = True
End Sub

I have no idea where to add these statements. How do I get to the jQuery options?


#7

These statements can go anywhere. Global Code is a good place.

You only need to do this if you are using PhoneGap. Are you?


#8

I am using PhoneGap.
I am struggling to get a simple AJAX app running.


#9

I would try to get the AJAX code working first as a web app. PhoneGap adds another layer of complication you probably don’t need at this point. Once your test code is working, integrate it into PhoneGap.