Hi,
I am intending to distribute my app with an empty database, such that the reports will run, but just return 'no data'. The user then has the option of downloading a filled database to get the full system, as well as being able to update as and when required
.
The Original db File has a size of 612,352 bytes (created on my Android phone).
If I FTP it up to internet, and back down (just to check) it is still 612,352 bytes and the system works OK.
If however when I download with the application using HTTPUtils the file size after download is only 606,208 bytes! Some reports will still work, however some reports produce:-
'android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed'
Not really surprising since I've lost 6,000 bytes. However as some reports do still work I'm assuming that it is the tail end of the file that is missing, but I can't find anything obviously wrong.
<code>
Sub JobDone (Job As String)
Dim olddate, newdate As String
Dim sqlstring As String, sqlCursor As Cursor
Dim In As InputStream, Out As OutputStream
If HttpUtils.IsSuccess(dlfilename) Then
Select Job
Case "Job1"
'
Case "Job2"
' Handling input stream
File.copy2(HttpUtils.GetInputStream(dlfilename),File.OpenOutput(File.DirDefaultExternal, "update.db", False) )
File.copy(File.DirDefaultExternal,"grj.db",File.DirDefaultExternal,"old.db")
File.copy(File.DirDefaultExternal,"update.db",File.DirDefaultExternal,"grj.db")
'
ToastMessageShow("New Data downloaded OK!", False)
Button_InstallUpdate.Enabled = False
End Select
Else
Button_InstallUpdate.Enabled = False
ToastMessageShow("Can't Connect to Server: Check Internet Connection or Try Later!",True)
End If
End Sub
Sub Button_InstallUpdate_Click
dlfilename = datasrc
ToastMessageShow("Downloading Update - May take a minute or so. . .",True)
Log("Database=" & datasrc)
HttpUtils.CallbackActivity = "Main" 'Current activity name.
HttpUtils.CallbackJobDoneSub = "JobDone"
HttpUtils.Download("Job2", dlfilename)
End Sub
</code>
Any Ideas?
Douglas
I am intending to distribute my app with an empty database, such that the reports will run, but just return 'no data'. The user then has the option of downloading a filled database to get the full system, as well as being able to update as and when required
.
The Original db File has a size of 612,352 bytes (created on my Android phone).
If I FTP it up to internet, and back down (just to check) it is still 612,352 bytes and the system works OK.
If however when I download with the application using HTTPUtils the file size after download is only 606,208 bytes! Some reports will still work, however some reports produce:-
'android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed'
Not really surprising since I've lost 6,000 bytes. However as some reports do still work I'm assuming that it is the tail end of the file that is missing, but I can't find anything obviously wrong.
<code>
Sub JobDone (Job As String)
Dim olddate, newdate As String
Dim sqlstring As String, sqlCursor As Cursor
Dim In As InputStream, Out As OutputStream
If HttpUtils.IsSuccess(dlfilename) Then
Select Job
Case "Job1"
'
Case "Job2"
' Handling input stream
File.copy2(HttpUtils.GetInputStream(dlfilename),File.OpenOutput(File.DirDefaultExternal, "update.db", False) )
File.copy(File.DirDefaultExternal,"grj.db",File.DirDefaultExternal,"old.db")
File.copy(File.DirDefaultExternal,"update.db",File.DirDefaultExternal,"grj.db")
'
ToastMessageShow("New Data downloaded OK!", False)
Button_InstallUpdate.Enabled = False
End Select
Else
Button_InstallUpdate.Enabled = False
ToastMessageShow("Can't Connect to Server: Check Internet Connection or Try Later!",True)
End If
End Sub
Sub Button_InstallUpdate_Click
dlfilename = datasrc
ToastMessageShow("Downloading Update - May take a minute or so. . .",True)
Log("Database=" & datasrc)
HttpUtils.CallbackActivity = "Main" 'Current activity name.
HttpUtils.CallbackJobDoneSub = "JobDone"
HttpUtils.Download("Job2", dlfilename)
End Sub
</code>
Any Ideas?
Douglas