I added Button1 to the keyValueStore2 example, it increments the value Starter.pos.
The value persists when opening from 'Recent Apps' but gets re-initialized if the app is closed and re-opened.
I can see that datastore22 is updated each time the app closes.
Sub Button1_Click
Starter.pos = Starter.pos + 1
Starter.kvs.Put("numbers", Starter.pos) 'updates Pos, not persistent
Log("Button1_Click update Pos = " & Starter.pos)
End Sub
I even tried a few If/Else statements in Starter_Create but still need a pointer on how to get around the re-initialize issue.
#Region Service Attributes
Sub Process_Globals
Public kvs As KeyValueStore
Dim pos = 4 As Int[\code]
End Sub
Sub Service_Create
kvs.Initialize(File.DirDefaultExternal, "datastore22") '
Log("Service_Create pos= " & (kvs.Get("numbers")))
End Sub
added the project file.