# ๐Ÿš€ 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 ```bash # Buka Android Studio # File โ†’ Open โ†’ Pilih folder Starter-EAS-2025-2026 # Tunggu Gradle sync selesai ``` ### Step 2: Build Project ```bash # 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 ```bash # 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: ```bash # 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 ```kotlin // Di MainActivity.kt, tambahkan: android.util.Log.d("LocationDebug", "Lat: $latitude, Lon: $longitude, Distance: $distance, Valid: $isLocationValid") ``` ### View Logs ```bash # Via Logcat adb logcat | grep "LocationDebug" # Or in Android Studio: View โ†’ Tool Windows โ†’ Logcat โ†’ Filter: "LocationDebug" ``` ### Debug GPS Specifically ```bash # 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 guide - `TECHNICAL_REFERENCE_LOKASI.md` - Tech details - `LOKASI_TROUBLESHOOTING.md` - Problem solving **Version**: 2.0 **Date**: 14 January 2026 **Status**: โœ… READY FOR DEPLOYMENT