# ๐Ÿ“‹ QUICK REFERENCE CARD - Aplikasi Absensi Akademik ## ๐Ÿš€ Quick Start ### 1. Build & Run ```bash cd /Users/maccomputer/AndroidStudioProjects/Starter-EAS-2025-2026 ./gradlew clean build ./gradlew installDebug ``` ### 2. First Login - NPM: (register dulu) - Password: (sesuai pilihan) ### 3. Test Absensi - Allow location & camera permissions - Ambil foto - Kirim absensi (otomatis validate lokasi) - Lihat riwayat --- ## ๐Ÿ”ง Key Configuration Points ### Campus Location **File**: `MainActivity.kt` (line ~70) ```kotlin campusLat: Double = -6.2030, // Ubah ini campusLon: Double = 107.0045, // Ubah ini radiusMeters: Float = 100f // Ubah ini (meter) ``` ### Webhook URL **File**: `MainActivity.kt` (line ~110) ```kotlin val url = URL("https://n8n.lab.ubharajaya.ac.id/webhook/...") ``` ### Database Version **File**: `DatabaseHelper.kt` (line ~12) ```kotlin private const val DATABASE_VERSION = 2 ``` --- ## ๐Ÿ“ฑ Screen Navigation ``` LOGIN โ†โ†’ REGISTER โ†“ ABSENSI (ambil foto + lokasi) โ”œโ”€ Kirim (validate lokasi โ†’ webhook) โ””โ”€ Lihat Riwayat โ†’ HISTORY (list) ``` --- ## ๐Ÿ“Š Database Schema ### Users Table ```sql id | username | npm (UNIQUE) | password ``` ### Attendance Table (NEW) ```sql id | npm (FK) | timestamp | latitude | longitude | status ``` **Status Values**: - `"success"` - dalam radius - `"invalid_location"` - diluar radius --- ## ๐Ÿ”จ Main Functions ### Location Functions ```kotlin calculateDistance(lat1, lon1, lat2, lon2): Float โ†“ Hitung jarak dalam meter isWithinAbsensiRadius(studentLat, studentLon, ...): Boolean โ†“ Cek apakah dalam radius absensi obfuscateCoordinates(lat, lon, offset): Pair โ†“ Obfuscate koordinat untuk privacy ``` ### Database Functions ```kotlin db.addAttendanceRecord(npm, timestamp, lat, lon, status): Boolean โ†“ Simpan record absensi db.getAttendanceHistory(npm): List โ†“ Ambil riwayat absensi ``` ### Network Functions ```kotlin kirimKeN8n(context, db, npm, nama, lat, lon, foto) โ†“ Send data ke webhook dengan validasi ``` --- ## โšก Common Tasks ### Ubah Lokasi Campus Edit `MainActivity.kt` line ~68: ```kotlin fun isWithinAbsensiRadius( studentLat: Double, studentLon: Double, campusLat: Double = -6.2030, // CHANGE THIS campusLon: Double = 107.0045, // CHANGE THIS radiusMeters: Float = 100f // CHANGE THIS ) ``` ### Ubah Radius ```kotlin radiusMeters: Float = 200f // Ganti 100 menjadi 200 ``` ### Ubah Webhook URL Edit `MainActivity.kt` line ~110: ```kotlin val url = URL("https://your-webhook-url-here") ``` ### Clear Database ```bash adb shell pm clear id.ac.ubharajaya.sistemakademik ``` ### View Database ```bash adb pull /data/data/id.ac.ubharajaya.sistemakademik/databases/Akademik.db ``` --- ## ๐Ÿงช Testing Quick Checklist - [ ] Register user baru - [ ] Login dengan NPM/password - [ ] Ambil foto (grant camera permission) - [ ] Check lokasi (grant location permission) - [ ] Kirim absensi - [ ] Verifikasi di database: - [ ] Attendance record tersimpan - [ ] Status = "success" atau "invalid_location" - [ ] Timestamp correct - [ ] Lihat riwayat - [ ] List muncul - [ ] Status indicator (โœ“/โœ—) benar - [ ] Tanggal format Indonesia --- ## ๐Ÿ› Debugging Tips ### View Logs ```bash adb logcat id.ac.ubharajaya.sistemakademik:V *:S ``` ### Check Database Content ```bash adb shell sqlite3 /data/data/id.ac.ubharajaya.sistemakademik/databases/Akademik.db > SELECT * FROM users; > SELECT * FROM attendance; > .quit ``` ### Test Permission ```bash adb shell pm grant id.ac.ubharajaya.sistemakademik android.permission.ACCESS_FINE_LOCATION adb shell pm grant id.ac.ubharajaya.sistemakademik android.permission.CAMERA ``` --- ## ๐Ÿ“ฆ Dependencies ```gradle // Core androidx.core:core-ktx androidx.activity:activity-compose:1.9.0 // Compose androidx.compose.ui androidx.compose.material3 androidx.compose.material:material-icons-extended:1.6.0 // Location com.google.android.gms:play-services-location:21.0.1 ``` --- ## ๐Ÿ“‚ Project Structure ``` app/ โ”œโ”€โ”€ src/main/ โ”‚ โ”œโ”€โ”€ java/id/ac/ubharajaya/sistemakademik/ โ”‚ โ”‚ โ”œโ”€โ”€ MainActivity.kt (main app, all screens) โ”‚ โ”‚ โ””โ”€โ”€ DatabaseHelper.kt (database operations) โ”‚ โ”œโ”€โ”€ res/ โ”‚ โ”‚ โ”œโ”€โ”€ values/ (strings, colors, themes) โ”‚ โ”‚ โ”œโ”€โ”€ layout/ (compose layouts) โ”‚ โ”‚ โ””โ”€โ”€ drawable/ (icons, images) โ”‚ โ””โ”€โ”€ AndroidManifest.xml (permissions, activities) โ”œโ”€โ”€ build.gradle.kts (dependencies, build config) โ””โ”€โ”€ ... ``` --- ## ๐Ÿ” Permissions Required ```xml ``` --- ## ๐Ÿ“ˆ Useful Metrics | Metric | Value | |--------|-------| | Min SDK | 28 | | Target SDK | 36 | | Compile SDK | 36 | | Java Version | 11 | | Default Radius | 100 meters | | Photo Quality | 80% JPEG | | DB Version | 2 | --- ## ๐ŸŽฏ Data Flow Summary ``` User Input โ†“ Validate (location, photo) โ†“ Save to Local DB โ†“ Send to Webhook (n8n) โ†“ Show Feedback โ†“ Update History UI ``` --- ## ๐Ÿ’ก Tips & Tricks 1. **Testing Location**: - Use Android Emulator's extended controls to simulate location - Or physically go ke lokasi yang valid 2. **Debugging Photo**: - Photo tersimpan sebagai Bitmap in-memory - Convert to Base64 untuk webhook - Tidak di-save ke storage (enhancement needed) 3. **Database Testing**: - Pull database dan buka di SQLite browser - Check attendance records dan status values - Verify foreign key relationships 4. **Network Testing**: - Monitor network calls di Android Studio Profiler - Check webhook responses di n8n dashboard - Use packet sniffer (tcpdump) untuk HTTPS analysis --- ## ๐Ÿšจ Common Issues & Solutions | Issue | Solution | |-------|----------| | Location null | Grant permission, wait for GPS lock | | Photo not captured | Check camera permission, device has camera | | Webhook timeout | Check internet, verify URL | | DB migration error | Clear app data, reinstall | | Permission denied | Grant at runtime, check manifest | --- ## ๐Ÿ“š Documentation Files | File | Content | |------|---------| | `DEVELOPMENT_GUIDE.md` | User guide, features, setup | | `CHANGELOG.md` | Version history, detailed changes | | `IMPLEMENTATION_NOTES.md` | Technical config, debugging | | `IMPLEMENTATION_SUMMARY.md` | Project summary, metrics | | `QUICK_REFERENCE.md` | This file - quick lookup | --- ## ๐Ÿ”— Important URLs - **Webhook Test**: https://n8n.lab.ubharajaya.ac.id/webhook-test/... - **Webhook Prod**: https://n8n.lab.ubharajaya.ac.id/webhook/... - **Ntfy Monitoring**: https://ntfy.ubharajaya.ac.id/EAS - **Spreadsheet Tracking**: https://docs.google.com/spreadsheets/d/1jH15MfnNgpPGuGeid0hYfY7fFUHCEFbCmg8afTyyLZs/ --- **Last Updated**: 14 January 2026 **Version**: 1.1.0 **For**: Aplikasi Absensi Akademik Berbasis Koordinat dan Foto