I have suddenly started to get this error after I uninstalled and reinstalled my app
Here is the relevant code and the error log. Note that I am accessing this database in other modules and have no issues with writing to any of the other tables in it.
I haven't changed anything relating to this code for a while, the only thing that has changed is that I completely uninstalled and reinstalled the app, instead of just updating it.
Here is the relevant code and the error log. Note that I am accessing this database in other modules and have no issues with writing to any of the other tables in it.
B4X:
In my Main Activity
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
If File.Exists(File.DirDefaultExternal,DbFileName) = False Then
DBUtils.CopyDBFromAssets(DbFileName)
DBUtils.CopyDBFromAssets(DbFileName2)
End If
StartService(Location)
End If
End Sub
In the Location Service
Dim DbFileName As String : DbFileName = "WorkOrder.db"
SQL1.Initialize(File.DirDefaultExternal,DbFileName,False)
.
.
. code setting up maps
.
DBUtils.InsertMaps(SQL1,"WOLO",lMaps)
Log Entry
InsertMaps (first query out of 1): INSERT INTO [WOLO] ([employee_id], [l_stamp], [latitude], [longitude], [bearing], [accuracy], [speed], [app_status]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
(SQLiteReadOnlyDatabaseException) android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
I haven't changed anything relating to this code for a while, the only thing that has changed is that I completely uninstalled and reinstalled the app, instead of just updating it.