Android to Laptop file transfer ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Android to Laptop file transfer ?
I am about to start on a project which will require small amounts of data to be sent from an Android device to a lap top computer (I want to transmit GPS position from time to time). I understand that sockets are not available in the most recent release of Android Livecode but as I've never used sockets I don't understand the significance of this missing feature. I have gained an impression from reading the forums that I could get data from the Android Device using URL commands if the Laptop is running a web server. Am I correct and is there a better way ?
best wishes
Simon
best wishes
Simon
best wishes
Skids
Skids
Re: Android to Laptop file transfer ?
Hi Simon,
Yes, you can use LiveCode to create a simple web server and get URL's from this webserver. The webserver can parse the URL and thus read the data.
Kind regards,
Mark
Yes, you can use LiveCode to create a simple web server and get URL's from this webserver. The webserver can parse the URL and thus read the data.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Android to Laptop file transfer ?
If you don't have livecode server and want to see an example of an httpd stack in livecode you should check here.. http://andregarzia.com/page/revonrockets
As it says on the page its not a replacement for apache, but if all you want is to transfer small amounts of data back and forth from android to desktop on a small scale its a great place to start.
As it says on the page its not a replacement for apache, but if all you want is to transfer small amounts of data back and forth from android to desktop on a small scale its a great place to start.
Re: Android to Laptop file transfer ?
Hi,
You really don't want to use LiveCode Server for this. That's way over the top. RevonRockets is a nice idea, but figuring out how it works might be more work than making your own.
All you want is open a socket for listening and parse whatever comes in. If it is something your little server app can understand, then process it, otherwise discard it.
Kind regards,
Mark
You really don't want to use LiveCode Server for this. That's way over the top. RevonRockets is a nice idea, but figuring out how it works might be more work than making your own.
All you want is open a socket for listening and parse whatever comes in. If it is something your little server app can understand, then process it, otherwise discard it.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Android to Laptop file transfer ?
Maybe. Since there are no sockets on the Android end the best solution would probably be creating a RESTful server, and creating that from scratch without RevOnRockets might be a lot of work that Andre's already done.RevonRockets is a nice idea, but figuring out how it works might be more work than making your own.
Re: Android to Laptop file transfer ?
you don't need "sockets" on the Android, since the Android is the client, not the server.
Mark
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Android to Laptop file transfer ?
Yes, I realize that. But you have a limited palette of operations using url functions, so you have to set up your own server on the other (non-Android) end. Since the OP says "I've never used sockets" then Andre's library may avoid a lot of trial and error.
Re: Android to Laptop file transfer ?
I would really recommend reading up on sockets and trying to make your own server. The problem is that we're not talking about a file server. The URL needs to be parsed. It is going to be a lot of work to adjust RoR to add the parsing feature and making a simple server really isn't difficult. Although some people say nothing should be done for the first time, I think there's a first time for everything, including making your own little server app.
Mark
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Re: Android to Laptop file transfer ?
Thanks for the information : I was half expecting that it was not going to be possible due to "missing" features in the Android code base. I'm attracted to the idea of creating my own "server" application as a way of gaining greater understanding.
Thanks again for the pointers and the confirmation that the project can be written in Livecode.
Thanks again for the pointers and the confirmation that the project can be written in Livecode.
best wishes
Skids
Skids
Re: Android to Laptop file transfer ?
It's a little round-about, but if you have a web server somewhere already you could write a text file there and then read it on the laptop. That would require internet access on both ends though, I don't know if you want that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android to Laptop file transfer ?
Writing your own server will allow you to make it efficient and spec'd exactly as you want, but it would still be educational to look at RoR.
For example, I took rev on rockets, added 2 handlers to the libcgi stack, built a stack for android and voila' Suddenly I have a mouse remote control. (I did have to put together an external also to do the actual clicks because lc doesn't include the ability to click a non-lc window programmatically, however it was easy enough to do the external and it works the charm!)
Basically I took the pre-existing RoR stack and added these 2 handlers to the libcgi stack.
Since andre already has things set up to handle passed URL strings and break them into their name/value pairs it was easy to send x and y coords and grab them with gRequestA["x"] and y.
Writing your own is great, but learning from others code, especially something as nifty as this, can be a real boost towards that end.
And of course as jacque said while I was typing, if you have access to a web server, both your android and desktop can hit it to get and add updates or whatever you need to do that way also.
For example, I took rev on rockets, added 2 handlers to the libcgi stack, built a stack for android and voila' Suddenly I have a mouse remote control. (I did have to put together an external also to do the actual clicks because lc doesn't include the ability to click a non-lc window programmatically, however it was easy enough to do the external and it works the charm!)
Basically I took the pre-existing RoR stack and added these 2 handlers to the libcgi stack.
Code: Select all
command moveMouse
put the screenmouseloc into tLoc
add gRequestA["x"] to item 1 of tLoc
add gRequestA["y"] to item 2 of tLoc
set the screenmouseloc to tLoc
libCGI_Response("moved to" && tLoc),"text/plain"
put gRequestA["x"] && gRequestA["y"] after msg
end moveMouse
command doClick
clickit
libCGI_Response ("0"), "text/plain"
end doClick
Writing your own is great, but learning from others code, especially something as nifty as this, can be a real boost towards that end.
And of course as jacque said while I was typing, if you have access to a web server, both your android and desktop can hit it to get and add updates or whatever you need to do that way also.
-
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Re: Android to Laptop file transfer ?
Jacque - unfortunately only the laptop will be connected with the internet so I don't think that I will be able to follow your suggestion.
Sturgis I will download RevOnRockets and have a look at the code.
I have also discovered what a socket is - an IP address plus a port number
Thankfully Matt Neuburg has a chapter in his Definitive Guide to RealBasic that describes the structure of both a server and a client using TCP/IP which clarifies many things. I should receive my Android phone soon and be able to start playing with it, then the questions will really start !
Thanks again
Simon
Sturgis I will download RevOnRockets and have a look at the code.
I have also discovered what a socket is - an IP address plus a port number

Thankfully Matt Neuburg has a chapter in his Definitive Guide to RealBasic that describes the structure of both a server and a client using TCP/IP which clarifies many things. I should receive my Android phone soon and be able to start playing with it, then the questions will really start !
Thanks again
Simon
best wishes
Skids
Skids