HOW TO PUBLISH A NEW APP UPDATE (read this every time you release)
====================================================================

1. BUILD A SIGNED RELEASE APK (one-time keystore setup, then every release)
   ------------------------------------------------------------------
   You cannot ship the debug APK to real users. You need a *signed
   release* APK, and — this part matters — it must be signed with the
   SAME keystore every single time, forever. If you sign a future
   update with a different keystore, Android will refuse to install it
   over the existing app (users would have to uninstall and lose their
   local data first). So:

   a) Create a keystore ONCE (skip if you already have one):
        keytool -genkeypair -v -keystore hr-release-key.jks \
          -alias hr_release -keyalg RSA -keysize 2048 -validity 10000
      Store hr-release-key.jks + its passwords somewhere safe and
      backed up (password manager / secure drive). If you lose it, you
      can NEVER push an update to existing installs again — only a
      fresh install under a new app.

   b) In Android Studio: Build > Generate Signed Bundle / APK > APK >
      pick hr-release-key.jks > choose "release" build variant > Finish.
      (Or from the command line: ./gradlew assembleRelease, after adding
      a signingConfigs block in app/build.gradle.kts that points to the
      same keystore.)

   c) The APK file you need is the one it produces here:
        mobile_app/app/build/outputs/apk/release/app-release.apk
      That is THE file you attach/upload — not the debug one from
      app/build/outputs/apk/debug/, and not an .aab (App Bundle) file,
      since a direct-download link needs a plain installable .apk.

2. BEFORE BUILDING, BUMP THE VERSION
   ------------------------------------------------------------------
   In mobile_app/app/build.gradle.kts, increase both:
        versionCode = 4        // must go UP by at least 1 every release
        versionName = "3.1.0"  // human-readable, shown in the popup
   This versionCode is what you'll also type into "App Version Code"
   in the vendor console — they must match, or the app will think it's
   already up to date.

3. UPLOAD THE APK HERE
   ------------------------------------------------------------------
   Upload app-release.apk into THIS folder (hr_system/downloads/) on
   your live web server, e.g. via FTP/SFTP or your hosting file
   manager. Suggested name so old links don't silently 404:
        app-latest.apk
   (overwrite the same filename each release, so the URL never changes)

4. SET THE URL IN THE VENDOR CONSOLE
   ------------------------------------------------------------------
   In "Push Product Update" (Companies & Licenses > Vendor Console),
   set "APK Download URL" to wherever this folder is publicly reachable,
   e.g.:
        https://yourdomain.com/hr_system/downloads/app-latest.apk
   and "App Version Code" to the versionCode from step 2. Submitting
   the form is what makes every organization's users get the real
   "Update Now" popup on their phones.

5. WHAT THE USER EXPERIENCES
   ------------------------------------------------------------------
   Tapping "Update Now" opens that URL in the browser, which downloads
   the APK. Since it's not from the Play Store, Android will ask them
   to allow "install unknown apps" for that browser the first time —
   this is normal and expected for direct-APK distribution. After that,
   installing over the old app works fine (same keystore = update,
   not a fresh install), and their existing data stays intact.
