SQlite error:undefined (Code 5)

I have a number of native Android Apps developed using AppStudio 8.5.7.5. I am building via VoltBuilder using engine name=“android” spec=“9.1.0”. The Apps run just fine after they are first installed on an Android Device (Samsung Galaxy A50, S20, S22). If I leave the app, to run something else on the phone, and then come back at a later time, it continues to work fine.

If the App is dumped from memoory by the Adroid System or if I close the App (remove from active memory by swiping up from the ||| OS screen) and then start it again, I get an SQlite error:undefined (Code 5) error popup. It doesn’t matter how may times I now close the app and try to rerun it, I still get the same error popping up. I know that for some reason, the SQL database is not responding or connecting correctly. (This error has only started up since about 4 months ago where new Android patches have been updating the cell phones).

If I go to the phones Setting > Apps > {My Apps name} > Storage and “Clear” the data; and then run the App, I get no error. I know that a new Datasebase is being created and I can see the original data that is stored in it.

I have tried all sort of things to resolve this issue but to no avail. It is always the first SQL Select statement that fails. (See code below).

The following code snippet is what I have in the Project Properties and Global Code section:

document.addEventListener("deviceready", onDeviceReady, False)

gDataBase=SqlOpenDatabase("PEATS.db")
If gDataBase=0 Then
  NSB.MsgBox("Database Not found", 0, "Please restart Application")
End If

Function onDeviceReady() 
  Dim T
  
  document.addEventListener("backbutton", onBackKeyDown, False)
  addReceiveListeners()
  createUDPSocket()
  
  NSB.ShowProgress("Loading Support Data...")
  T=SetTimeout(LoadSupportData,3000)   
End Function

Sub LoadSupportData()
  Dim sqlList
  sqlList    = []
  sqlList[0] = ["Select * from HandheldSettings;", HandheldSettingHandler]
  sqlList[1] = ["Select * from ProvStates ORDER BY Sequence;", ProvinceHandler]
  sqlList[2] = ["Select * from PrivateComments ORDER BY Sequence, Description;", PrivateCommentsHandler]
  sqlList[3] = ["Select * from PublicComments ORDER BY Sequence, Description;", PublicCommentsHandler]
  sqlList[4] = ["Select * from PINBooks;", PINBookHandler]
  
  sqlList[5] = ["Select * from TerminalFiles WHERE Updated_On IS NULL;", TerminalFilesHandler]
  sqlList[6] = ["Select * from SavedTxn;", CountSavedTxnHandler]
  sqlList[7] = ["Select * from SavedPhotos;", CountSavedPhotoHandler]
  sqlList[8] = ["Delete from PlateList;", ClearedPlateListHandler]

  Sql(gDataBase,sqlList)  
  
End Sub

Any help would be greatly Appreciated as it is causing my customers a lot of pain and worry.
Many Thanks,
Robert

Are you using a plugin for SQLite? Which one?

PS. You probably should upgrade your engine to the current one - Google is getting serious about dropping support for 9.1.0.

Yes, I am using the following plugin: plugin name=“cordova-sqlite-evcore-extbuild-free” source=“npm”
According to the VoltBuilder log it is using version “cordova-sqlite-evcore-extbuild-free: 0.18.0”.

I think this might be something to ask about on the plugin’s support page. I don’t think this is an AppStudio/VoltBuilder issue.