Browser widget android local file problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Browser widget android local file problem

J. Landman Gay via use-livecode
Am having a problem loading a local file that displays a Google map on the Android emulator. LC 8.1.6.

I was also having a problem with local HTML files in general, but got that going. Using the same method for a dynamically created map document, located in the specialfolderpath("documents") folder doesn't seem to work. See below for code that doesn't work followed by code that works.

1. Code that doesn't work is (using a file from the "documents" specialFolder):
---
       put specialFolderPath("documents") & slash & "MAP.html" into tMapFile
        -- tMapFile = /data/data/com.scruffmonkey.echidnaCSI/files/MAP.html   -- Why is the path /data/data/...  and not /data/app/...  as in the next example?
       if the platform contains "android" then
            set the url of widget "myMap" to tMapFile
       else
            put fileConvertToFileURL(tMapFile) into tURL
            set the url of widget "myMap" to (tURL)
       end if
---


2. While code that works is (using a file from the resources folder):
---
      put specialFolderPath("resources") & "/data/fun_facts.html" into tFile
     -- tFile = /data/app/com.scruffmonkey.echidnaCSI-2/base.apk/data/fun_facts.html
      if the platform contains "android" then
         set the url of widget "infoscroll" to (tFile)
      else
         put fileConvertToFileURL(tFile) into tURL
         set the url of widget "infoscroll" to (tURL)
      end if
---


Any ideas why there's a difference between the resources and documents specialFolderPaths?

Why does the "documents" specialFolderPath here start with /data/data/  and the resources one start with /data/app/  ??

I've also tried setting the HTMLText of the widget but that also doesn't seem to work.

Help please! :-)

cheers

Alan
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Browser widget android local file problem

J. Landman Gay via use-livecode
Hi Alan - setting the htmltext of the widget works fine for me. My map data comes from Bing. What is going wrong when you do that?

Sent from my iPhone

> On Aug 24, 2017, at 9:29 AM, Alan via use-livecode <[hidden email]> wrote:
>
> Am having a problem loading a local file that displays a Google map on the Android emulator. LC 8.1.6.
>
> I was also having a problem with local HTML files in general, but got that going. Using the same method for a dynamically created map document, located in the specialfolderpath("documents") folder doesn't seem to work. See below for code that doesn't work followed by code that works.
>
> 1. Code that doesn't work is (using a file from the "documents" specialFolder):
> ---
>       put specialFolderPath("documents") & slash & "MAP.html" into tMapFile
>    -- tMapFile = /data/data/com.scruffmonkey.echidnaCSI/files/MAP.html   -- Why is the path /data/data/...  and not /data/app/...  as in the next example?
>       if the platform contains "android" then
>            set the url of widget "myMap" to tMapFile
>       else
>            put fileConvertToFileURL(tMapFile) into tURL
>            set the url of widget "myMap" to (tURL)
>       end if
> ---
>
>
> 2. While code that works is (using a file from the resources folder):
> ---
>      put specialFolderPath("resources") & "/data/fun_facts.html" into tFile
>     -- tFile = /data/app/com.scruffmonkey.echidnaCSI-2/base.apk/data/fun_facts.html
>      if the platform contains "android" then
>         set the url of widget "infoscroll" to (tFile)
>      else
>         put fileConvertToFileURL(tFile) into tURL
>         set the url of widget "infoscroll" to (tURL)
>      end if
> ---
>
>
> Any ideas why there's a difference between the resources and documents specialFolderPaths?
>
> Why does the "documents" specialFolderPath here start with /data/data/  and the resources one start with /data/app/  ??
>
> I've also tried setting the HTMLText of the widget but that also doesn't seem to work.
>
> Help please! :-)
>
> cheers
>
> Alan
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Browser widget android local file problem

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
On 8/24/17 8:29 AM, Alan via use-livecode wrote:
> Any ideas why there's a difference between the resources and documents specialFolderPaths?
>
> Why does the "documents" specialFolderPath here start with/data/data/   and the resources one start with/data/app/   ??

Like on a desktop machine, the folders are located in different places
in the file hierarchy. These are actually virtual folders; they don't
really exist since the whole thing is done in memory.

If you aren't able to get results from the documents folder, I'd have
the script check first to make sure the file is really there.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode