How do I Access Local Files in Android

Get help using Construct 2

Post » Wed Apr 30, 2014 2:40 pm

I wanted to access my locally stored json files. Would reading the files locally work using AJAX? But it seems having a file://<path> is not allowed. Please advice other possible approach. Thanks.
sleep is only for the weak!
B
91
S
30
G
12
Posts: 139
Reputation: 11,992

Post » Wed Apr 30, 2014 2:47 pm

This is a security tradeoff with BRowsers. System security. Accessing files without valid permission will fail. And Browsers are really strict on accessing any files outside of the server domain directory. Any files you want I suggest including into the project files list at the project heirarchy(right click include on the file folder). Then at run time you can use AJAX to directly access the file.

If you want free roaming file access to android directory structure. There isn't one. Yet. As for reasons noted above. i think there is Cordova feature that let us so, but there is no implementation of it as of yet under any platforms.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Wed Apr 30, 2014 3:16 pm

Thanks for the confirmation, somehow I knew this answer is coming. I hope construct 2 can have a a local data access plugin implementation similar to Cordova . For the current work around ^^. hello global variable!
sleep is only for the weak!
B
91
S
30
G
12
Posts: 139
Reputation: 11,992


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 4 guests