# Attendance Kotlin App

This folder contains a simple Android application written in Kotlin that
connects to the existing TAF API. The app allows an employee to:

1. **Sign in and out** – Posts a time record to `/api/timeclocks` using the
   `TimeClocksController`. The older `/employeeportal/clockIn` and
   `/employeeportal/clockOut` endpoints are deprecated and not used by this app.
2. **Geofence enforcement** – Location is captured on sign in/out and the
   backend validates whether the employee is within any authorised location.
   Users may have multiple stations or field sites assigned.
3. **Face capture** – When clocking in or out the app uses the front camera to
   take a photo which is stored locally alongside the clock record.
4. **Face registration** – Users can register a reference photo which is used
   for Face ID verification on clock in/out.
5. **View attendance history** – Records are stored locally and displayed on
   the main screen.
6. **Offline sign in** – Clock events are saved in a local Room database when
   offline and automatically synced to the API when connectivity is restored.

> **Face recognition model**
> The application relies on a TensorFlow Lite model named
> `mobile_facenet.tflite` stored in `app/src/main/assets`.
> If the file is missing, download it from
> [this link](https://github.com/vipulasri/tensorflow-android-examples/blob/master/face-recognition-demo/src/main/assets/mobile_facenet.tflite)
> and place it in the assets directory before building the project.

The project is a minimal Android Studio structure with `Retrofit` for network
access, `Room` for local storage and `FusedLocationProvider` for obtaining the
user's location.

When clocking in or out the app requests the `ACCESS_FINE_LOCATION` runtime
permission. Granting this permission ensures latitude and longitude are attached
to each clock event.

To build the app open the `kotlin` directory in Android Studio.

