Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

json files

Hello,

I've just read the documentation 'File system access for apps' but I'm still comfused with how json files are working on BB10 :

Imagine my app provides an original json with some datas in it.
The user can add datas too.
What if I package a new version of my app with new datas added compared with the original json ?

Thanks for your help,
Laurent

Twitter : @LaurentKP
My apps
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: json files

The very first time that you user use your app, you must move your json file from your app to a Read/Write directory if you plan the user update the file. After that, if your deply a new version with new data in your json file you have to check if the user have a r/w json file so you have to do somw kind of synchronization between the two files to keep the changes the user did.

 

HTH

 

Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: json files

Ok we have to deal with the synchronization Smiley Frustrated

Do we have an example in the cascades samples maybe ?

Twitter : @LaurentKP
My apps
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: json files

Sorry,do not have an example but the idea is to check what you have in one file and then add/update in the other one.

You can use a special flag to mark those "records" that changed in the original file and then update the file in the user path accordingly.

Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: json files

Well, maybe it's better to manage two json files : one for the app datas and an other one for the user datas and load them at start in the listview.

Twitter : @LaurentKP
My apps
Highlighted
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: json files

It's easier to manage one, but it depend if the synchronization is complex...