8.3 KiB
8.3 KiB
🚀 DEPLOYMENT GUIDE - Sistem Lokasi Absensi
✅ Pre-Deployment Checklist
Sebelum build & deploy, pastikan:
CODE:
☑️ MainActivity.kt sudah benar
☑️ Koordinat UBH benar (-6.2447, 106.9956)
☑️ Radius konsisten (250m)
☑️ Tidak ada error/warning penting
PERMISSIONS:
☑️ AndroidManifest.xml memiliki:
- ACCESS_FINE_LOCATION
- ACCESS_COARSE_LOCATION
- CAMERA
- INTERNET
DATABASE:
☑️ DatabaseHelper.kt OK (tidak ada perubahan)
☑️ SQLite database ready
GRADLE:
☑️ build.gradle.kts OK
☑️ Dependencies resolved
☑️ SDK version valid
ENVIRONMENT:
☑️ Android Studio latest
☑️ JDK 17+ installed
☑️ Min SDK API 24
☑️ Target SDK API 35
📋 Build Steps
Step 1: Verifikasi Code
# Buka Android Studio
# File → Open → Pilih folder Starter-EAS-2025-2026
# Tunggu Gradle sync selesai
Step 2: Build Project
# Via Terminal di Android Studio (atau Command Line)
# Build APK (Debug)
./gradlew clean build
# Jika ada error, coba:
./gradlew clean
./gradlew build --stacktrace
# Build for Release (optional, untuk production)
./gradlew bundleRelease
Step 3: Check Build Output
✓ Tidak ada error (Errors tab kosong)
✓ Warnings boleh, tapi bukan blocker
✓ Output: app/build/outputs/apk/debug/app-debug.apk
📱 Install ke Device
Option 1: Via Android Studio
1. Hubungkan device via USB
2. Build → Run (atau Shift + F10)
3. Pilih device target
4. Tunggu APK install
5. Aplikasi otomatis launch
Option 2: Via Command Line
# Ensure device connected
adb devices
# Install debug APK
adb install app/build/outputs/apk/debug/app-debug.apk
# Atau dengan gradle:
./gradlew installDebug
# Uninstall jika perlu
adb uninstall id.ac.ubharajaya.sistemakademik
Option 3: Via APK File
1. Copy: app/build/outputs/apk/debug/app-debug.apk
2. Transfer ke device (USB/Email/Drive)
3. Buka File Manager → Navigate to APK
4. Tap → Install
5. Buka aplikasi
🧪 Testing Procedure
Test 1: Login & Navigation
Langkah:
1. Buka aplikasi
2. Lihat Login screen
3. Klik "Belum punya akun? Daftar"
4. Registrasi user baru:
- Nama: Test User
- NPM: 12345678
- Password: test1234
5. Klik "Daftar"
6. Kembali ke Login screen
7. Login dengan NPM & Password yang baru dibuat
8. Masuk ke Absensi screen
Expected: ✓ Login berhasil, navigasi lancar
Test 2: GPS Location
Langkah:
1. Pastikan GPS aktif di device
2. Buka aplikasi di area luar gedung (outdoor)
3. Lihat card informasi lokasi
4. Tunggu 5-10 detik hingga koordinat muncul
Expected:
✓ Koordinat Lat/Lon tampil
✓ Card berubah warna:
- HIJAU jika jarak ≤ 250m (within radius)
- MERAH jika jarak > 250m (outside radius)
Test 3: Distance Validation
Test Case 1 - Within Radius:
1. Buka app di area kampus
2. Lihat card status = "✓ Valid" (HIJAU)
3. Lihat jarak < 250m
4. Tombol Submit jadi ENABLED
Test Case 2 - Outside Radius:
1. Buka app di luar area kampus
2. Lihat card status = "✗ Tidak Valid" (MERAH)
3. Lihat jarak > 250m
4. Tombol Submit DISABLED (abu-abu)
Expected: ✓ Validasi akurat & konsisten
Test 4: Camera & Photo
Langkah:
1. Klik tombol "📷 Ambil Foto"
2. Izinkan akses kamera
3. Ambil foto/selfie
4. Lihat preview foto di aplikasi
Expected: ✓ Foto berhasil diambil dan tersimpan
Test 5: Submit & Database
Langkah:
1. Pastikan status HIJAU + foto ada
2. Klik "📤 Kirim Absensi"
3. Tunggu notifikasi
Expected:
✓ Toast message "Absensi diterima server"
✓ Klik "Lihat Riwayat"
✓ Lihat record terbaru di history list
Test di Firebase/N8N:
4. Buka N8N webhook URL
5. Lihat data absensi terbaru ada
Test 6: Multiple Locations
Test di berbagai lokasi:
1. Kampus (< 250m) → Status HIJAU ✓
2. Pinggir kampus (249m) → Status HIJAU ✓
3. Batas radius (250m) → Status HIJAU ✓
4. Luar radius (251m) → Status MERAH ✗
5. Jauh dari kampus (500m+) → Status MERAH ✗
Expected: ✓ Validasi akurat di setiap lokasi
🔍 Troubleshooting Deployment
Build Error: "Build Failed"
Solusi:
1. Clean project: ./gradlew clean
2. Invalidate cache: File → Invalidate Caches
3. Rebuild: ./gradlew build --stacktrace
4. Jika masih error, cek AndroidManifest.xml
Error: "Gradle Sync Failed"
Solusi:
1. Update Gradle: Tools → SDK Manager
2. Update Kotlin: Check plugins version
3. Sync Again: File → Sync Now
Error: "Permission Denied" saat install
Solusi:
1. Uninstall app lama: adb uninstall id.ac.ubharajaya.sistemakademik
2. Enable USB Debugging: Settings → Developer Options → USB Debugging
3. Authorize device jika pop-up muncul
4. Coba install lagi
GPS/Location not working
Solusi:
1. Device Settings → Location → ON
2. Switch to "High Accuracy" mode
3. Buka app di area terbuka (outdoor)
4. Tunggu 15 detik GPS lock
5. Check Logs: adb logcat | grep "Location"
App Crash saat buka
Solusi:
1. Lihat Logcat: Logcat (Alt+6) di Android Studio
2. Search "Exception" atau "Error"
3. Note error message
4. Check MainActivity.kt & DatabaseHelper.kt
5. Rebuild & reinstall
📊 QA Checklist
Sebelum "Production Ready":
FUNCTIONALITY:
☑️ Login/Register bekerja
☑️ GPS location berfungsi
☑️ Distance calculation akurat
☑️ Photo capture berfungsi
☑️ Submit ke N8N bekerja
☑️ Database save bekerja
☑️ History display bekerja
UI/UX:
☑️ Layout responsif
☑️ Tidak ada visual glitch
☑️ Button state changes correctly
☑️ Card color changes correct (green/red)
☑️ Text visible & readable
☑️ No crash on navigation
PERMISSIONS:
☑️ Location permission request works
☑️ Camera permission request works
☑️ User dapat deny & app tidak crash
EDGE CASES:
☑️ Offline mode - app tidak crash
☑️ No GPS - error handled gracefully
☑️ No camera - error handled
☑️ Fast switching between screens
☑️ Device rotation - no crash
PERFORMANCE:
☑️ App launch < 3 seconds
☑️ GPS lock < 15 seconds
☑️ Submit < 5 seconds
☑️ Memory usage normal
☑️ No ANR (App Not Responding)
📦 Release Build (Optional)
Jika ingin release ke Play Store:
# Build signed APK/AAB
./gradlew bundleRelease
# Output akan ada di:
# app/build/outputs/bundle/release/app-release.aab
# Upload ke Google Play Console
# 1. Create signing key (jika belum ada)
# 2. Sign release build
# 3. Upload ke Play Store
# 4. Set as production build
# 5. Submit untuk review
🔐 Security Checklist
Sebelum production:
☑️ Password di-hash di database
☑️ Tidak ada hardcoded credentials
☑️ API keys di-obfuscate
☑️ Koordinat di-offset (privacy)
☑️ HTTPS untuk API calls
☑️ Input validation implemented
☑️ SQL injection prevention
☑️ Permissions minimal necessary
📞 Support & Debugging
Enable Detailed Logging
// Di MainActivity.kt, tambahkan:
android.util.Log.d("LocationDebug",
"Lat: $latitude, Lon: $longitude, Distance: $distance, Valid: $isLocationValid")
View Logs
# Via Logcat
adb logcat | grep "LocationDebug"
# Or in Android Studio:
View → Tool Windows → Logcat → Filter: "LocationDebug"
Debug GPS Specifically
# Check location services
adb shell dumpsys location
# View all sensors
adb shell dumpsys sensormanager
📋 Deployment Checklist - Final
PRE-DEPLOYMENT:
☑️ Code review selesai
☑️ Build success (no errors)
☑️ Testing passed (all test cases)
☑️ Permissions set correctly
☑️ Database initialized
☑️ N8N webhook configured
☑️ Network connectivity tested
DEPLOYMENT:
☑️ Device connected & recognized
☑️ APK installed successfully
☑️ App launches without crash
☑️ All features working
☑️ No runtime errors
POST-DEPLOYMENT:
☑️ User testing complete
☑️ Feedback collected
☑️ Performance monitored
☑️ Error logs reviewed
☑️ Ready for next update
🎉 DEPLOYMENT COMPLETE!
Jika semua checklist ✓, aplikasi siap untuk:
- ✅ Digunakan oleh pengguna
- ✅ Disebarkan ke device lain
- ✅ Deploy ke production
- ✅ Monitor dan maintenance
Reference Files:
LOKASI_QUICK_START.md- User guideTECHNICAL_REFERENCE_LOKASI.md- Tech detailsLOKASI_TROUBLESHOOTING.md- Problem solving
Version: 2.0
Date: 14 January 2026
Status: ✅ READY FOR DEPLOYMENT