Problem with HTTP access on Android

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Problem with HTTP access on Android

Post by wfr747 » Thu Sep 06, 2018 3:26 pm

Hi forum,

I want to populate a field via HTTP. It works great on Windows, but the app hangs on the Android phone when I try to import the data. The "Internet" is included in the "Inclusions".

Like this:

Code: Select all

 put url "http://myDomain/myText.txt" into tt
   put tt into fld "input"
I use LC 9 (rc2) Community
Windows 10
Samsung Galaxy S7

Thank you
Walter

Klaus
Posts: 10472
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with HTTP access on Android

Post by Klaus » Thu Sep 06, 2018 3:35 pm

Hallo Walter,

we already discussed this in the german LC forum and could not find any reason for this.
I don't own any mobile device, so I could not test it.

Before someone asks:
THE RESULT is EMPTY right after -> put url...
And INTERNET has been checked in the Sandalone Builder Settings.

These are important infos, so please always supply every info you have immediately, or this will also take 198 postings before coming to a conclusion or (hopefully) a solution.


Best

Klaus

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Re: Problem with HTTP access on Android

Post by wfr747 » Thu Sep 06, 2018 3:43 pm

Klaus, you are omnipresent! :D

Walter

Klaus
Posts: 10472
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with HTTP access on Android

Post by Klaus » Thu Sep 06, 2018 3:46 pm

That's very, very true! :D

But now I'm off for band rehearsal...

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Re: Problem with HTTP access on Android

Post by wfr747 » Thu Sep 06, 2018 3:48 pm

The Android version is 8.0.0

bogs
Posts: 2377
Joined: Sat Feb 25, 2017 10:45 pm

Re: Problem with HTTP access on Android

Post by bogs » Thu Sep 06, 2018 3:50 pm

Klaus wrote:
Thu Sep 06, 2018 3:35 pm
Before someone asks:
THE RESULT is EMPTY right after -> put url...
And INTERNET has been checked in the Sandalone Builder Settings.
Um, he did include that, it is just worded differently :wink:
wfr747 wrote:
Thu Sep 06, 2018 3:26 pm
but the app hangs on the Android phone when I try to import the data. The "Internet" is included in the "Inclusions".
Klaus is indeed omnipresent. I think he is also the almighty all-powerful omnipotent stomper, but that is just an opinion :mrgreen:

Have fun at band rehearsal Klaus!
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4701
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Problem with HTTP access on Android

Post by jacque » Fri Sep 07, 2018 6:18 pm

There are two places in standalone settings where you need to specify internet. The first is in the Inclusions pane, as you did already. That tells LC to include the internet libraries. The second place is in the Android settings pane in the permissions section at the lower right. That tells Android OS to allow internet access. Both settings must be enabled.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

wfr747
Posts: 12
Joined: Sat Aug 18, 2018 3:53 pm

Re: Problem with HTTP access on Android

Post by wfr747 » Sun Sep 09, 2018 11:36 am

Hi Jacqueline,

Thank you very much, that works!

BTW: how would I write back to the Internet-File?

Code: Select all

put myText into url "http://myServer/text.txt"

won't work

Thank you
Walter

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6229
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Problem with HTTP access on Android

Post by FourthWorld » Sun Sep 09, 2018 5:32 pm

wfr747 wrote:
Sun Sep 09, 2018 11:36 am
BTW: how would I write back to the Internet-File?
Very carefully. After all, if it's easy for you to overwrite files on a server, it would be easy for criminals anywhere in the world to do the same.

HTTPS is usually the best choice for most server tasks, unless you have a specific reason why another protocol is more suited to your needs. For simply writing data to a server, it's the most commonly used.

On the server you will need a program to work in conjunctions with your web server application to handle the specifics of your write request. This common need is handled by the Common Gateway Interface (CGI), and a version of LiveCode, LiveCode Server, is available for use on servers supporting CGI, such as Apache.

See LC's Dictionary for how to use the POST command to send data to an HTTP/HTTPS server, and this tutorial for how to accept that data:
http://lessons.livecode.com/m/4070/l/36 ... ode-server

To avoid misuse of your server by others, you will likely want some form of authentication for write actions. Whether HTTP Basic Auth is sufficient or something more is needed will depend on the sensitivity of the data and what else is on the server. In most cases Basic Auth is fine.

With any sensitive communications you'll want to encrypt the connection so eavesdroppers do not see the password in transit. That's where HTTPS comes in, as opposed to HTTP. Let's Encrypt and other services now provide free web server security certificates to allow HTTPS at no cost. Contact your hosting company to set up a free certificate if you do not already have one in place.

There are other considerations, but this will get you started. I wish I could report that managing a server is as easy as managing client software, but with all servers under constant attack by very smart people using very good tools, we must be diligent lest our server become compromised for use by criminals.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”