How do I write/create/store files locally on mobile devices?

Get help using Construct 2

Post » Sun Mar 12, 2017 12:38 pm

Hi all.

I would like to manage a database that can be modified and created by the users in-game and I would like to do it through (create/write/store) local files instead of web storage. I was searching the web and the forum to find the answer if Construct 2 can write and store local files but I can't find a straight answer. Many people only asking about how to read external files but what I want to do is not only read existing files but also write and create local files on mobile devices and I'm wondering if Construct 2 can do that or not?

So far it seems like I can generate JSON files and download it, but it is not exactly what I want because I want to store the files within the application and not to download them. NW.js object seems to be able to read and write files locally, but it is desktop only as far as I know but I need the functionality on mobile (or is it works on mobile too?).

Anyone could tell me please if it possible to create, write and store local files in a Construct 2 application on mobile devices?

Thanks in advance.
B
4
S
1
Posts: 28
Reputation: 406

Post » Sun Mar 12, 2017 10:51 pm

@ddabrahim

I am not an expert on saving local files. but I do a lot with databases.
As far as i know, the whole idea of writing to local files on mobile is considered a major security threat, so pretty much the only local option would be to use Local Storage. You could take an array full of data and store that in Local Storage easily. I guess it depends on how much data you want to store, and how important data integrity is - if it is local, people will find a way to modify it in ways you might not want.

Setting up a database on a web site and passing data back and forth with AJAX calls is not that hard and works really well for me. Then you have access and a lot more control over all the data your users are saving - if you want to do any kind of statistics, or checking if anything suspicious is going on.
B
95
S
33
G
20
Posts: 438
Reputation: 17,640

Post » Mon Mar 13, 2017 9:02 pm

Thank you for your reply. I thought writing local files might be not an option, actually I'm just experimenting with Local Storage and it seems to be fine but data integrity is very important I don't know how reliable it is. I haven't actually thought about setting up a database on a website, I'm might give it some thought.

Thanks.
B
4
S
1
Posts: 28
Reputation: 406


Return to How do I....?

Who is online

Users browsing this forum: David181, luckyrawatlucky and 3 guests