- Node.js server running at
http://192.168.2.244:5001 - Android device/emulator on the same network
- MongoDB database configured
cd api
node server.jsServer should start on port 5001.
If your server IP is different, update:
- File:
app/src/main/java/com/secure/privacyfirst/network/RetrofitClient.kt - Line:
private const val BASE_URL = "http://192.168.2.244:5001/" - Also update:
app/src/main/res/xml/network_security_config.xml
./gradlew clean build./gradlew installDebugOr use Android Studio:
- Click "Run" button
- Select your device/emulator
- Open the app
- Complete onboarding and setup
- Navigate to WebView screen
Filter by tags:
WebViewScreenWhitelistRepositoryTokenManager
Expected logs:
D/WebViewScreen: Fetching whitelist from server...
D/WhitelistRepository: Login successful, token saved
D/WhitelistRepository: Whitelist fetched successfully: 17 URLs
- Navigate to a whitelisted URL (e.g., https://sbi.co.in)
- Should load successfully
- Try a non-whitelisted URL
- Should show warning dialog
curl -X POST http://192.168.2.244:5001/api/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"pass123"}'Expected response:
{
"token": "eyJhbGc...",
"expiresIn": "1h"
}curl -X GET http://192.168.2.244:5001/api/whitelist/ \
-H "Authorization: Bearer YOUR_TOKEN_HERE"Expected response:
{
"urls": ["sbi.co.in", "icicibank.com", ...],
"count": 17
}Check:
- Server is running:
curl http://192.168.2.244:5001/api/login - Phone is on same network as server
- Firewall allows port 5001
- IP address is correct
Fix:
- Update IP in
RetrofitClient.kt - Check server logs for errors
- Ensure MongoDB is connected
Fix:
Update network_security_config.xml with your server IP:
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">YOUR_IP_HERE</domain>
</domain-config>Check:
- Admin credentials in
.envfile - JWT_SECRET is set
- Server logs for authentication errors
Fix:
Update credentials in WhitelistRepository.kt:
private const val ADMIN_USERNAME = "your_username"
private const val ADMIN_PASSWORD = "your_password"Check Logcat for:
- Network errors
- JSON parsing errors
- Missing dependencies
Fix:
./gradlew clean
./gradlew buildMONGO_URI=mongodb+srv://...
ADMIN_USERNAME=admin
ADMIN_PASSWORD=pass123
JWT_SECRET=your_random_secret
PORT=5001private const val BASE_URL = "http://192.168.2.244:5001/"<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">192.168.2.244</domain>
</domain-config>- Daily Refresh: Implement WorkManager to refresh whitelist periodically
- Offline Support: Cache whitelist in Room database
- Admin UI: Add management screen for CRUD operations
- Production: Change to HTTPS for production server
For issues:
- Check server logs:
node server.js - Check app logs: Android Studio Logcat
- Verify network connectivity
- Review WHITELIST_API_INTEGRATION.md for details