Network Access for Standalone Applications

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cbitterfield
Posts: 5
Joined: Wed Feb 03, 2021 4:43 am

Network Access for Standalone Applications

Post by cbitterfield » Wed Feb 03, 2021 4:50 am

I am working on an application for Android on my MACBook Pro. (Community Version LC9) and BigSur.

The application works fine on the Mac. However when I compile for standalone use the application has no access to the network.

I am using a restAPI webserver on my network. The virtual Android, Real Tablet and my mac via chrome can all access the RESTapi no problem.

All standalone applications have no access to the network. Virtual, Tablet or MAC. I have tried every setting in standalone applications and I can see that android tablets have no access by default and there does not seem to be a way to turn this on.

Is this a community version issue? or some setting I am missing. I create a very basic application from this guide:
"How to Request a Resource from a REST API" from Livecode lessons.

It works in Livecode but not as a stand alone application.

stam
Posts: 2633
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Network Access for Standalone Applications

Post by stam » Wed Feb 03, 2021 8:45 am

Hi cbitterfield,
Might be worth manually setting inclusions in the standalone settings and ensuring internet, SSL, JSON and mergJSON
are included (along with any other functionality needed by your app).
When things work in the IDE but not the standalone, it’s usually because of missing inclusions (the automatically detect inclusions setting doesn’t work that well!).

Hope that helps,
Stam

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

Re: Network Access for Standalone Applications

Post by bogs » Wed Feb 03, 2021 11:28 am

This same question came up recently elsewhere, Jacque may have already provided the answer you need.
Image

cbitterfield
Posts: 5
Joined: Wed Feb 03, 2021 4:43 am

Re: Network Access for Standalone Applications

Post by cbitterfield » Wed Feb 03, 2021 2:29 pm

Followed the instructions and still not working:

Inclusions
  • Switch Button
    Spinner
    Browser
    JSON Library
    Time zone Library
    DataGrid
    Internet
    SSL & Encryption
    Answer Dialog
    Ask Dialong
    mergJSON
Android Settings
  • Requirements and Restrictions
    - Telephony CDMA
    - Telephony GSM

    Application Permissions
    Write External Storage
    Internet
    Vibration
    Idel Timer
Using Virtual Tablet for testing
RESTapi works via Chrome on virtual Tablet
No Response on get JSON from URL on Application. (Just hangs)
No data transferred


On the Application Permissions; no permissions granted is showing.
I can't enable permisions (all) it doesn't stick.
Application is signed for development.
During installation it does say no special permissions required.

Also OSX (APP) does work now.

The RESTapi is running http unencrypted and does not require any keys or security. (simple get provides response)

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

Re: Network Access for Standalone Applications

Post by jacque » Wed Feb 03, 2021 6:15 pm

Virtual emulators do not always respond like real devices. Do you have access to a real Android device?

You could also try adding the TSNet inclusion, it adds more advanced features to the internet library (you should include both.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

cbitterfield
Posts: 5
Joined: Wed Feb 03, 2021 4:43 am

Re: Network Access for Standalone Applications

Post by cbitterfield » Wed Feb 03, 2021 10:49 pm

I checked in with an Android 9 tablet. (Same issue)

TSNet is only in LiveCode Indy or Business.

cbitterfield
Posts: 5
Joined: Wed Feb 03, 2021 4:43 am

Re: Network Access for Standalone Applications

Post by cbitterfield » Thu Feb 04, 2021 1:03 am

Is there anyway to get this to work on Community Edition or Community Plus Edition?

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

Re: Network Access for Standalone Applications

Post by jacque » Thu Feb 04, 2021 2:17 am

I'm sure you can make it work but there's not enough info to tell what's wrong. Do you get the result after executing an internet interaction? You can "answer the result" or write it to a log. That may tell you something. Also extensive logging can allow you to see where in the scripts things go wrong. On mobile I usually write the log to a file in the documents folder and then add a temporary button that puts the log text into a field so I can read it.

Or you could post the relevant part of the script here, maybe someone will notice a problem.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Network Access for Standalone Applications

Post by elanorb » Fri Feb 05, 2021 11:00 am

Hi

This might be because of the version of Android your devices are using and the fact that the RESTapi is running http unencrypted. Starting with Android 9 cleartext support is disabled by default which prevents http connections.

There is a bug report for this which includes some options for workarounds.

https://quality.livecode.com/show_bug.cgi?id=22400

I hope that helps.

Elanor
Elanor Buchanan
Software Developer
LiveCode

cbitterfield
Posts: 5
Joined: Wed Feb 03, 2021 4:43 am

Re: Network Access for Standalone Applications

Post by cbitterfield » Fri Feb 05, 2021 3:21 pm

How do I add this file to the Livecode build? Is this an external file? or is there some way to set it?

v/r

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Network Access for Standalone Applications

Post by elanorb » Mon Feb 08, 2021 4:42 pm

Hi

If you want to try option 2, which is probably the simpler option, you would need to apply the suggested changes to the Android manifest template in the LiveCode app.

You said you are on Mac so to find this file choose "Show Package Contents" on the LiveCode app bundle. The file you need to modify is in Contents/Tools/Runtime/Android/Manifest.xml. I suggest making a copy of the original file before trying the workaround so you can go back to the original file if you need to.

I hope that helps.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: Network Access for Standalone Applications

Post by jekyllandhyde » Wed Mar 10, 2021 8:13 pm

Elanor,

I need to modify the manifest.xml file to include http support for an arduino web server which can't do https, at least until Panos's fix gets released in the next Livecode version. I am completely stumped how to do this on a mac? When I build the apk, Android studio only allows viewing the package contents, not modifying. I tried including the appropriate xml entry into the included files so it would be included but that doesn't work. Sorry I'm not the most technical so perhaps this isn't possible yet?

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

Any advice appreciated.

Cheers, Adam

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Network Access for Standalone Applications

Post by elanorb » Thu Mar 11, 2021 5:20 pm

Hi Adam

You actually make the changes in the LiveCode app bundle, so the updated version of the manifest file is included in the Android apps you build.

Go to Applications, find your LiveCode app and then follow the instructions to choose "Show Package Contents" etc. The change will then be applied to all Android standalones you make, hopefully that will not be a problem.

Please let me know if you need any further clarification.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: Network Access for Standalone Applications

Post by jekyllandhyde » Thu Mar 11, 2021 6:42 pm

Thanks, I think I am cluing in now.

What you are saying is go here on my Mac: /Applications/LiveCode Indy 9.6.1.app/Contents/Tools/Runtime/Android/manifest.xml

edit the manifest file and it will include the cleartraffic entry on every android build...

It worked, thanks!

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Network Access for Standalone Applications

Post by elanorb » Fri Mar 12, 2021 11:47 am

Great! Glad to hear you got it working.

The fix is targeted to be included in 9.6.3 so you won't have to worry about it after that. If you do update, when 9.6.2 is released, or if you have to reinstall or are you using a different machine you will need to reapply the manual fix.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”