database works fine in Livecode, not in Android

Creating desktop or client-server database solutions?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

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

Re: database works fine in Livecode, not in Android

Post by Klaus » Thu Jan 25, 2018 8:50 pm

From the dictionary about "documents folder":
On Android the documents folder property returns the path to a folder that can be used for per-application data files.

This property is read only and is equivalent to the specialFolderPath("documents") function.
I do not develop for mobile nor do I own any mobile device, so I would consider this either a BUG or a dcumantation flaw. :D

Sorry, have to pass this to real Android users.

SparkOut
Posts: 1807
Joined: Sun Sep 23, 2007 4:58 pm

Re: database works fine in Livecode, not in Android

Post by SparkOut » Fri Jan 26, 2018 7:49 am

/mnt/sdcard/ may get you to a publicly writeable folder. This isn't necessarily "The Documents" folder, and different devices may have different paths to the public location. I think /mnt/sdcard/ is simlinked a lot and will probably be the nearest thing to a universal location, whatever the local path on the device. It works on the few different devices I have tried. MaxV may know more?

Your app contains the sandboxed location found by specialFolderPath ("documents") and this is only writeable by your app. On first install, this folder is empty and will only ever contain something if your app specifically writes something there.

When you build the standalone, the files you include in the list in the tab of the standalone builder are included in the specialFolderPath("resources") folder. This is NOT a writeable location. If you want to use a database file you have included, you first have to copy it from the resources to documents folder. (Check if the file already exists in the destination though because otherwise on the second, third and every other launch it will overwrite the database with the empty one.)

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

Re: database works fine in Livecode, not in Android

Post by jacque » Sat Jan 27, 2018 3:34 am

Try specialFolderPath("external documents") for the user-viewable folder on the public shared drive. Be sure in Android standalone settings you check "External storage". This special folder path was just added recently so if it doesn't work, make sure you've updated LC to the most recent version. I can't remember exactly which version first included it.

The original specialFolderPath("documents") is the app-specific documents folder that isn't visible in a file browser.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

MaxV
Posts: 1540
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: database works fine in Livecode, not in Android

Post by MaxV » Mon Jan 29, 2018 4:36 pm

Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

Manu9351
Posts: 19
Joined: Sun Jan 07, 2018 8:48 pm

Re: database works fine in Livecode, not in Android

Post by Manu9351 » Wed Feb 14, 2018 7:42 pm

thanks to everybody!
specialFolderPath("External documents") works fine, but the update to the new version of livecode brought up another problem..
viewtopic.php?f=53&t=30619

Post Reply

Return to “Databases”