I found the issue, It was simple, the uploadFlagToCustomer() function is inside a ViewModel and I am calling this function from an AlertDialog.Builder. when I removed that AlertDialog, its inserting value to SQLite.
Below is the code on the Activity
private fun callDialog(database, flags) {
flagViewModel.uploadFlagToCustomer(database, flags)
/* val bl = AlertDialog.Builder(this)
bl.setTitle("Save/Clear Flags?")
bl.setNeutralButton("Clear", null)
bl.setPositiveButton(
"Save & Exit"
) { dialog: DialogInterface?, _: Int -> flagViewModel.uploadFlagToCustomer(database, flags) }
val d: Dialog = bl.create()
d.setCanceledOnTouchOutside(false)
d.setCancelable(false)
d.setOnDismissListener { _: DialogInterface? ->
flagViewModel.clearFlags(routeId)
}
d.show()*/
}
There was no issue with the SQlite it was this part that caused the problem