tsNet mobile working or not?

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
Gurgen
Posts: 34
Joined: Thu Dec 10, 2015 2:09 pm

tsNet mobile working or not?

Post by Gurgen » Fri Sep 23, 2016 8:53 pm

Hi forum,

I'm very happy with livecode tsNet new library, it's way faster than libURl and livecode GET, POST...

So I've written a code to download a list of files using tsNetGetFile, it's working well on desktop and dictionary says that "tsNetGetFile" is for android and iOS too, BUT!!! I can't get it to work in mobile.

Please help to figure out this.

See the code.

Regards,
Gurgen

Code: Select all

######################################################
# TS DONWLOAD
######################################################
local sDownloadList
local tsDownload


-------------------------------------------------------------------------------
# downloadList
# pList: the list of files to download
# pSettings: An array contains download info
#                    pSettings["callbackobjectid"] : the object id to send callback
#                    pSettings["savepath"] : the file path to save files in
#                    pSettings["url"] : server URL, finishing with slash
#                    pSettings["maxonce"] : the maximum number of files to download at once
# CHANGES
#                    09/22/2016: created
--------------------------------------------------------------------------------
command downloadList pList, pSettings
   -- Save to local variables
   put pList into sDownloadList
   put 0 into tsDownload["index"]
   
   put pSettings["callbackobjectid"] into tsDownload["callbackobjectid"]
   put pSettings["savepath"] into tsDownload["savepath"]
   put pSettings["url"] into tsDownload["url"]
   put pSettings["maxonce"] into tsDownload["maxonce"]
   put 1 into tsDownload["startline"]
   
   -- Start download
   downloadGroup
end downloadList
-------------------------------------------------------------------------------



-------------------------------------------------------------------------------
# downloadGroup
# CHANGES
#                    09/22/2016: created
--------------------------------------------------------------------------------
command downloadGroup
   -- Loop to download files at once
   repeat with tFile = 1 to tsDownload["maxonce"]
      put (tFile + tsDownload["startline"] - 1) into tLine
      put line tLine of sDownloadList into sMedia
      
      -- Download using TS
      put tsNetGetFile(tFile, (tsDownload["savepath"] & sMedia), (tsDownload["url"] & sMedia),,"downloadComplate") into tResult
      
      -- Save the download result
      if tResult is empty then 
         put "ok" into tsDownload["files"][sMedia]
      else
         put tResult into tsDownload["files"][sMedia]
      end if
   end repeat
end downloadGroup
-------------------------------------------------------------------------------



-------------------------------------------------------------------------------
# downloadComplate
# pID: the id of connection
# CHANGES
#                    09/22/2016: created
--------------------------------------------------------------------------------
command downloadComplate pID
   add 1 to tsDownload["index"]
   
   -- Close connection
   tsNetCloseConn pID
   
   -- Group done
   if tsDownload["index"] mod tsDownload["maxonce"] = 0 then
      
      -- Send a callback with downloaded files info
      dispatch "downloadComplate" to  tsDownload["callbackobjectid"] with tsDownload["files"]
      
      -- Set do not backup for android
      if the platform is "iPhone" then
         repeat for each key tMedia in tsDownload["files"]
            iphoneSetDoNotBackupFile (tsDownload["savepath"] & tMedia)
         end repeat
      end if
      
      -- Reset 
      put empty into tsDownload["files"]
      
      -- Download is finished
      if tsDownload["index"] > the number of lines of sDownloadList then
         dispatch "downloadFinished" to tsDownload["callbackobjectid"]
         exit downloadComplate
      end if
      
      -- Go to next file group
      add tsDownload["maxonce"] to tsDownload["startline"]
      
      -- Download
      downloadGroup
   end if
end downloadComplate
################################################################


LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: tsNet mobile working or not?

Post by LiveCode_Panos » Fri Sep 23, 2016 10:08 pm

Hi Gurgen,

Have you added the tsNet inclusion in the standalone?

Best,
Panos
--

Gurgen
Posts: 34
Joined: Thu Dec 10, 2015 2:09 pm

Re: tsNet mobile working or not?

Post by Gurgen » Sat Sep 24, 2016 9:10 am

LiveCode_Panos wrote:Hi Gurgen,

Have you added the tsNet inclusion in the standalone?

Best,
Panos
--
Hi Panos,
Thanks for replay,

Yes I have. I have tryed with auto searching inclusions, with manual setting inclusions, tryed to call tsNetInit, no result, it just stops on tsNetGetFile. Also I have tryed with older version of LiveCode (8.0.1 DP3) and it's not working again.


Thanks,
Gurgen

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: tsNet mobile working or not?

Post by bangkok » Mon Nov 07, 2016 5:19 pm

Same issue here.

-no problem with tsNet library on Windows (desktop) (i use mainly the tsNetPostSync command)

-however with Android... no luck.

(LiveCode Indy 8.1.1)

I've checked the permissions, the inclusions, and the network (with the same mobile app, I connect to a MySQL DB)... everything looks OK.

So is tsNet working with Android or not ?

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

Re: tsNet mobile working or not?

Post by jacque » Tue Nov 08, 2016 5:48 pm

Make sure you have also checked the Internet checkbox in the Android pane in standalone settings.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: tsNet mobile working or not?

Post by bangkok » Thu Nov 17, 2016 11:47 am

OK it was a bug, with LiveCode Indy (which I use) or Business Edition.

See :

http://quality.livecode.com/show_bug.cgi?id=18498

"We fixed this bug in LiveCode 8.1.2 RC-1"

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”