The easiest way to store preferences for mi app?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Caronte3D
Posts: 187
Joined: Sat Nov 23, 2019 5:21 pm
Location: Some Universe

The easiest way to store preferences for mi app?

Post 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.
plouf
Posts: 295
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

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

Post 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
Christos
User avatar
Caronte3D
Posts: 187
Joined: Sat Nov 23, 2019 5:21 pm
Location: Some Universe

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

Post by Caronte3D »

Thanks both! ;)
plouf
Posts: 295
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

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

Post 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 :)
Christos
Quin
Posts: 118
Joined: Wed Nov 08, 2023 4:38 pm

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

Post 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.
User avatar
Caronte3D
Posts: 187
Joined: Sat Nov 23, 2019 5:21 pm
Location: Some Universe

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

Post 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
User avatar
Caronte3D
Posts: 187
Joined: Sat Nov 23, 2019 5:21 pm
Location: Some Universe

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

Post 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 ;)
User avatar
Caronte3D
Posts: 187
Joined: Sat Nov 23, 2019 5:21 pm
Location: Some Universe

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

Post by Caronte3D »

Also seems CreatePreferences doesn't erase the file if exists
tj1010
Posts: 218
Joined: Wed May 27, 2015 1:36 pm
Contact:

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

Post 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..
Post Reply