Page 1 of 1

The easiest way to store preferences for mi app?

Posted: Sun Nov 03, 2024 3:48 pm
by Caronte3D
I need to save my app preferences, what you guys use to do it?
I always use the Preferences library on PB, but since not exists in SB, I must use regular files? or any other methods?
Thanks! ;)

Edit: My app is an Android one.

Re: The easiest way to store preferences for mi app?

Posted: Sun Nov 03, 2024 3:59 pm
by plouf
hi

CreateFile(0,"preferences.txt",@SaveFileCallback(),#PB_LocalStorage)
works with adroid created app, i have use it.

user can delete using appsettings-> "clear all data" (not clear cache), which is way too accepted

Re: The easiest way to store preferences for mi app?

Posted: Sun Nov 03, 2024 4:03 pm
by Peter

Re: The easiest way to store preferences for mi app?

Posted: Sun Nov 03, 2024 4:16 pm
by Caronte3D
Thanks both! ;)

Re: The easiest way to store preferences for mi app?

Posted: Sun Nov 03, 2024 7:26 pm
by plouf
Peter wrote: Sun Nov 03, 2024 4:03 pm https://github.com/spiderbytes/Preferences
intresting
this must be included in next SB release imho
since its improves PB compatibility and all job is already done by peter :)

Re: The easiest way to store preferences for mi app?

Posted: Sun Nov 03, 2024 9:56 pm
by Quin
plouf wrote: Sun Nov 03, 2024 7:26 pm
Peter wrote: Sun Nov 03, 2024 4:03 pm https://github.com/spiderbytes/Preferences
intresting
this must be included in next SB release imho
since its improves PB compatibility and all job is already done by peter :)
Massive +1.

Re: The easiest way to store preferences for mi app?

Posted: Thu Nov 14, 2024 5:25 pm
by Caronte3D
Peter wrote: Sun Nov 03, 2024 4:03 pm https://github.com/spiderbytes/Preferences
Peter, have you tried the PreferenceKeyValue() function?
Seems the function ever return: ""
First, some variables appear as v_ but they are global, so I changed v_ to g_ but this did not solve the problem.
Can you take a look?
Thanks! ;)

Code: Select all

  ; Examine keys in the group 'Window'
  ExaminePreferenceKeys()
  While  NextPreferenceKey() ; While a key exists
    MessageRequester("Key group 'Window'", PreferenceKeyName() + " = " + PreferenceKeyValue())  ; Display the key with its data
  Wend

Re: The easiest way to store preferences for mi app?

Posted: Thu Nov 14, 2024 5:38 pm
by Caronte3D
Ok, I skiped a v_ :D so... now seems to work ok.
You must change some v_ to g_ in the preferences.sbi

Anyway I think you should check it ;)

Re: The easiest way to store preferences for mi app?

Posted: Thu Nov 14, 2024 7:14 pm
by Caronte3D
Also seems CreatePreferences doesn't erase the file if exists

Re: The easiest way to store preferences for mi app?

Posted: Sat Nov 16, 2024 8:05 pm
by tj1010
OpenFileRequester and ExportFile or deal with a lot of support issues do to cache policies, and yes literally everything besides those is dictated by cache policy of each user. Avoid Google-Drive stuff it's all broken.

NPM import is broken for Cordova libraries so you can't use third-party Cordova plugins right now(this is why I haven't fixed my Android/IOS file post or done new tips&tricks with BT, HTTP, WLAN etc..), and the official Cordova File plugin that does work just does the requester-download method SB already does..

The other solution is cloud over https but on desktop you have to run a server that disables XSS and XSRF protection..