2026-01-14 21:13:18 +07:00

7.3 KiB
Raw Permalink Blame History

🚀 Quick Start Guide - Aplikasi Absensi Akademik

Instalasi Cepat

1 Clone & Setup Project

# Clone atau buka project di Android Studio
cd Starter-EAS-2025-2026

# Sync gradle
./gradlew build

2 Konfigurasi Campus Location

File: app/src/main/java/id/ac/ubharajaya/sistemakademik/config/AppConfig.kt

object AppConfig {
    // Ubah sesuai lokasi kampus Anda
    const val CAMPUS_LATITUDE = -6.8961
    const val CAMPUS_LONGITUDE = 107.6100
    const val ATTENDANCE_RADIUS_METERS = 100f  // Radius validasi (meter)
}

3 Konfigurasi N8n Webhook

// Gunakan salah satu:
const val USE_WEBHOOK = N8N_WEBHOOK_PROD    // Production
// const val USE_WEBHOOK = N8N_WEBHOOK_TEST  // Testing

4 Build & Run

# Option 1: Via Android Studio
- Buka project di Android Studio
- Click "Run" atau Shift+F10
- Pilih emulator/device

# Option 2: Via Terminal
./gradlew installDebug

🔍 Testing Checklist

Scenario 1: Login & Attendance Success

1. Launch app
2. Input NPM: "12345678"
3. Input Nama: "John Doe"
4. Click "Login"
   ✓ Should navigate to attendance screen
5. Wait for location (check GPS enabled)
   ✓ Coordinates should display
   ✓ Status should show "Berada dalam area absensi" (green)
6. Click "Ambil Foto"
   ✓ Camera should open
   ✓ Take photo
   ✓ Status should show "✓ Foto berhasil diambil"
7. Click "Kirim Absensi"
   ✓ Should show "⏳ Mengirim absensi..."
   ✓ After success: "✓ Absensi berhasil dikirim!"
8. Click "Lihat Riwayat"
   ✓ Should show attendance record in list
9. Click back, then "Logout"
   ✓ Should return to login screen

Scenario 2: Location Outside Radius

1. After login and location loaded
2. Check if distance shows > 100m
   ✓ Status should show "✗ Berada di luar area absensi" (red)
   ✓ "Kirim Absensi" button should be disabled
3. Try clicking submit
   ✓ Should show error: "⚠️ Lokasi Anda berada di luar area absensi"

Scenario 3: Missing Photo

1. At attendance screen with valid location
2. DON'T click "Ambil Foto"
3. Try clicking "Kirim Absensi"
   ✓ Should show error: "⚠️ Harap ambil foto terlebih dahulu"

Scenario 4: Permission Denial

1. When location permission requested
2. Click "Deny"
   ✓ Should show toast: "Izin lokasi ditolak"
   ✓ Lokasi akan tetap menampilkan "-"

1. When camera permission requested
2. Click "Deny"
   ✓ Should show toast: "Izin kamera ditolak"

📱 Device Requirements

Requirement Min Target
SDK Version 28 36
RAM 2GB 4GB+
Storage 100MB 500MB+
Android 9.0 13+
GPS Required -
Camera Required -

🐛 Troubleshooting

Location tidak muncul

❌ Problem: "Lokasi tidak tersedia"
✅ Solution:
   1. Buka device settings → Location → ON
   2. Beri izin akses lokasi ke app
   3. Tunggu beberapa saat GPS acquire signal
   4. Click "Perbarui Lokasi" button

Tip: Gunakan emulator dengan:
- Google Play Services installed
- Location simulation enabled
- Set location di Extended Controls

Kamera error

❌ Problem: Camera tidak membuka
✅ Solution:
   1. Buka device settings → Apps → Permissions
   2. Berikan izin CAMERA
   3. Restart app
   4. Try "Ambil Foto" again

N8n Webhook timeout

❌ Problem: "✗ Gagal: timeout"
✅ Solution:
   1. Cek internet connection
   2. Pastikan URL di AppConfig.kt benar
   3. Test webhook di: https://ntfy.ubharajaya.ac.id/EAS
   4. Check N8n workflow status

Database error

❌ Problem: "Error inserting attendance"
✅ Solution:
   1. Clear app data:
      - Settings → Apps → [App Name] → Storage → Clear Data
   2. Restart app
   3. Try again

📊 Monitoring & Debugging

View Attendance Logs

Logcat Monitoring

# View all logs
adb logcat

# Filter by app package
adb logcat | grep "sistemakademik"

# View errors only
adb logcat | grep "ERROR\|Exception"

🔧 Configuration Tips

Mengubah Radius Validasi

// AppConfig.kt
const val ATTENDANCE_RADIUS_METERS = 50f   // Lebih ketat (50m)
const val ATTENDANCE_RADIUS_METERS = 200f  // Lebih longgar (200m)

Mengubah Kualitas Foto

// AppConfig.kt
const val PHOTO_COMPRESS_QUALITY = 50   // Lebih ringan
const val PHOTO_COMPRESS_QUALITY = 100  // Kualitas maksimal

Switch ke Testing Webhook

// AppConfig.kt
const val USE_WEBHOOK = N8N_WEBHOOK_TEST  // Uncomment ini

📚 Architecture Overview

┌─────────────────────────────────────────────┐
│           PRESENTATION LAYER                │
│  (Composables: Screens, ViewModels)         │
└─────────────────┬───────────────────────────┘
                  │
┌─────────────────▼───────────────────────────┐
│           DOMAIN LAYER                      │
│  (Use Cases: LocationValidator)             │
└─────────────────┬───────────────────────────┘
                  │
┌─────────────────▼───────────────────────────┐
│           DATA LAYER                        │
│  (Repository, Database, Preferences)        │
│  - Room (Local DB)                          │
│  - DataStore (User Session)                 │
│  - N8n Webhook (Remote API)                 │
└─────────────────────────────────────────────┘

🎯 Key Features

Feature Status Details
Login NPM + Nama validation
GPS Location Fused Location Provider
Radius Validation 100m default radius
Photo Capture Camera Intent
N8n Integration Base64 encoded image
History Room database
Session Management DataStore preferences

📞 Support Resources

Resource Link
Webhook Test https://ntfy.ubharajaya.ac.id/EAS
Attendance Spreadsheet https://docs.google.com/spreadsheets/
N8n Webhook Prod https://n8n.lab.ubharajaya.ac.id/webhook/...
N8n Webhook Test https://n8n.lab.ubharajaya.ac.id/webhook-test/...

💡 Pro Tips

  1. Testing dengan Multiple Devices: Test dengan emulator di lokasi berbeda
  2. Mock Location: Gunakan GPS Emulator app untuk testing location
  3. Network Throttling: Test di Android Studio dengan slow connection
  4. Database Inspector: Monitor Room database real-time
  5. Logcat Filtering: Gunakan grep untuk focused debugging

Happy Testing! 🎉

Untuk detailed documentation, lihat IMPLEMENTATION_GUIDE.md