iOS Question Registry Keys

ivanomonti

Expert
Licensed User
Longtime User
Hi Erel,

and can create registry keys on ios!

Thank 1000
 

ivanomonti

Expert
Licensed User
Longtime User
Did you mean this?

no filippo, volevo mettere nel dispositico alcuni dati senza doverli memorizzare in db sqlite, esempio login username e password oltre che uid.

filippo no, I wanted to put in some dispositico data without having to store them in a sqlite db, such as login username and password as well as uid

Example B4A > PreferenceManager
 
Upvote 0
D

Deleted member 103

Guest
Ci sarebbe questo ma per adesso non funziona nella version Beta.

There would be this but it does not work in the beta version.
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
You can create a SQlite DB with DBUtils, with a Table that saves preferences:
ID,User,Password,etc...
On startup, Query the table and if it's not present,create the table, query the fields, and fill the table

You can show a settings panel to enter/modify the table fields
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
Code to save settings to a file in text, very basic but at the moment is fine for testing.

scrittura

B4X:
Sub WriteSetting()

    Dim s,FileName As String
   
    s = emailaddress & "|" & password & "|" & nik
    FileName = "b4iosSetting"
   
    If File.Exists(File.DirAssets, FileName) = False Then
        File.WriteString(File.DirAssets, FileName,s)
    Else
        File.WriteString(File.DirAssets,FileName,s)
    End If
   
End Sub

Lettura

B4X:
Sub ReadSetting As Boolean
   
    Dim s,FileName As String
   
    FileName = "b4iosSetting"
   
    If File.Exists(File.DirAssets, FileName) = True Then
        s = File.ReadString(File.DirAssets, FileName)
        Dim value() As String
        value = Regex.Split("\|",s)
        emailaddress = value(0)
        password = value(1)
        nik = value(2)
        Return True
    Else
        Return False
    End If
   

   
End Sub
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
Hi, Erel

I can not read and write the text file for the setting ... and I do not know how to solve ( new B4I )
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code is taken from the Coordinates Converter example:
Loading settings:
B4X:
  Dim settings As Map = CreateMap("lat": "", "lon": "", "zone": "", _
     "x": "", "y": "", "llformat": 2, "region": 0, "datum": 0, "lastEdited": LAST_NONE, _
     "page": "main")
   If File.Exists(File.DirDocuments, "settings.txt") Then
     settings = File.ReadMap(File.DirDocuments, "settings.txt")
   End If
It first creates a map with the default values and then load the file if it exists.

Saving:
B4X:
Dim settings As Map = CreateMap("lat": txtLat.Text, "lon": txtLon.Text, "zone": txtZone.Text, _
     "x": txtX.Text, "y": txtY.Text, "llformat": llFormat, "region": scRegion.SelectedIndex, _
     "datum": Picker1.GetSelectedRow(0), "lastEdited": lastEditedFields)
File.WriteMap(File.DirDocuments, "settings.txt", settings)
 
Upvote 0
Top