'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim DirName As String : DirName = File.DirRootExternal & "/databaseinfo"
Dim FileNameislapp As String : FileNameislapp = "databaseinfo.txt"
End Sub
Sub Activity_Create(FirstTime As Boolean)
'make folder and Text file
If File.Exists(File.DirRootExternal,"/databaseinfo/databaseinfo.txt")=False Then
File.MakeDir(File.DirRootExternal,"databaseinfo")
Dim Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirRootExternal,"/databaseinfo/databaseinfo.txt",True))
SaveINI_ISLAPPL 'Safe new app version to Textfile
Else
LoadINI_ISLAPP 'check the App and database Version and copy the database if I upgrade the app and the database
End If
End Sub
Sub LoadINI_ISLAPP
Dim pm As PackageManager
Dim version As Int
Dim version_from_ini As Int
Dim rw As TextReader
rw.Initialize(File.OpenInput(DirName, FileNameislapp))
version_from_ini = rw.ReadLine
rw.Close
If version_from_ini < pm.GetVersionCode("sigster.upgrade_sample") Then
File.Copy(File.DirAssets, "database.db", File.DirDefaultExternal, "database.db")
SaveINI_ISLAPPL 'Safe app version to Textfile
Else
End If
End Sub
Sub SaveINI_ISLAPPL
'Safe app version to Textfile
Dim version As Int
Dim pm As PackageManager
version = pm.GetVersionCode("sigster.upgrade_sample")
Dim tw As TextWriter
tw.Initialize(File.OpenOutput(DirName, FileNameislapp, False))
tw.WriteLine(version)
tw.Close
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub