APIs & services / Firebase

Upload a zip of the app databases to Firebase Storage (urvi_clear_app_data/) before wiping data.

Endpointtoday's app
Call
SDK Firestore / Storage DB zip dump
Service
Firebase
Features
Sync error log
When
Clear app data / logout
Auth
Firebase app credentials
In the App Service

Use case

Before the one-time clear-app-data migration in HomeActivity.clearAppData (cadre login, non-Vrutti tenant, not yet cleared), ZipUtil.zipFilesAndSendToFireStore copies the app data directory, zips only the SYNC_QUEUE_DB database, and uploads it to Firebase Storage at urvi_clear_app_data/<cadreLogin><month+time>.zip (FireStoreUtil.addSyncQueueDBInFireStore). This is Storage, not Firestore. The SharedPref flag isClearedDataSentToFireStore records the result so the upload happens only once. The POST /sync-service/api/v1/data/so call follows, and app data is wiped only if that succeeds.

Headers

HeaderValueNotes
(Firebase SDK)<Firebase app credentials>No user auth.

Parameters

ParamInRequiredExampleNotes
pathpathYesurvi_clear_app_data/cadre_aJune10:15.zipName = cadreLogin + AppUtils.convertMillisToMonthNameAndHHSS(now) + ".zip". PII: login id in the object name.

Request

Example request body (synthetic data)
{
  "part": "zip containing databases/SYNC_QUEUE_DB (the whole offline operation table)"
}
FieldTypeRequiredNotes
zipapplication/zipYesPII/secret: raw queued request bodies and request headers, including session tokens.

Response

FieldTypeRequiredNotes
(none)n/aSuccess or failure only sets the isClearedDataSentToFireStore preference.

Errors

StatusWhenWhat the app does
SDK failureUpload failsThe flag stays false, so the upload is tried again on the next Home open. The clear-data flow continues to the sync-service upload regardless.

Source

  • app/src/main/java/org/platformcommons/urvi/utility/ZipUtil.kt
  • app/src/main/java/org/platformcommons/urvi/utility/BackupUtil.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/utils/FireStoreUtil.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/utils/Constants.kt
  • app/src/main/java/org/platformcommons/urvi/view/home/HomeActivity.kt