Android Configuration
Glance provides ADB-based support for intercepting traffic from Android devices and emulators.
Prerequisites
- ADB (Android Debug Bridge) installed
- USB debugging enabled on device
- Android 7.0 (API 24) or higher
Quick Setup
Glance can automatically configure your Android device:
- Connect device via USB or start emulator
- Run Glance with Android support:bash
glance --android - Glance will:
- Detect connected devices
- Install CA certificate
- Configure proxy settings
- Set up port forwarding
Manual Setup
Step 1: Enable USB Debugging
On your Android device:
- Go to Settings → About Phone
- Tap Build Number 7 times to enable Developer Options
- Go to Settings → Developer Options
- Enable USB Debugging
Step 2: Connect Device
bash
# List connected devices
adb devices
# Should show:
# List of devices attached
# ABC123456 deviceStep 3: Install CA Certificate
bash
# Export Glance CA certificate
curl http://localhost:15501/ca.crt -o glance-ca.crt
# Push to device
adb push glance-ca.crt /sdcard/
# Install certificate
# On device: Settings → Security → Install from storage
# Select glance-ca.crtStep 4: Configure Proxy
Method 1: ADB Reverse
bash
# Forward device's requests to Glance proxy
adb reverse tcp:15500 tcp:15500Method 2: WiFi Proxy (Android 10+)
- Go to Settings → Network & Internet → WiFi
- Long press your network → Modify Network
- Advanced Options → Proxy → Manual
- Set:
- Proxy hostname:
localhost(if using adb reverse) or your computer's IP - Proxy port:
15500
- Proxy hostname:
- Save
Method 3: Global Proxy (Requires Root)
bash
# Set global proxy
adb shell settings put global http_proxy localhost:15500
# Remove proxy
adb shell settings put global http_proxy :0Certificate Installation
User Certificate (Android 7-10)
For apps targeting API 24-29, user certificates work by default:
- Download CA certificate on device
- Settings → Security → Install from storage
- Select certificate file
- Name it "Glance CA"
- Select "VPN and apps" usage
System Certificate (Android 11+)
Apps targeting API 30+ only trust system certificates. Two options:
Option 1: Network Security Config (Developers)
Add to your app's network_security_config.xml:
xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user certificates for debugging -->
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</debug-overrides>
</network-security-config>Reference in AndroidManifest.xml:
xml
<application
android:networkSecurityConfig="@xml/network_security_config">
</application>Option 2: Install as System Certificate (Requires Root)
bash
# Get certificate hash
export CERT_HASH=$(openssl x509 -inform PEM -subject_hash_old -in glance-ca.crt | head -1)
# Remount system as writable
adb root
adb remount
# Push certificate
adb push glance-ca.crt /system/etc/security/cacerts/$CERT_HASH.0
# Set permissions
adb shell chmod 644 /system/etc/security/cacerts/$CERT_HASH.0
# Reboot
adb rebootEmulator Configuration
Android Studio Emulator
Emulators are easier to configure:
bash
# Start emulator with writable system
emulator -avd YOUR_AVD_NAME -writable-system
# Or configure proxy at startup
emulator -avd YOUR_AVD_NAME -http-proxy localhost:15500Certificate for Emulator
bash
# Emulator with root access
adb root
adb remount
# Push certificate to system
curl http://localhost:15501/ca.crt -o glance-ca.crt
adb push glance-ca.crt /system/etc/security/cacerts/$(openssl x509 -inform PEM -subject_hash_old -in glance-ca.crt | head -1).0
# Restart
adb rebootTesting
Verify configuration works:
bash
# On device, any app should route through proxy
# Open Chrome and visit any HTTPS site
# Traffic should appear in Glance dashboardOr use ADB:
bash
# Make request from device
adb shell curl https://api.github.com/users
# Should appear in GlanceFramework-Specific Configuration
OkHttp
kotlin
import okhttp3.*
import java.net.InetSocketAddress
import java.net.Proxy
val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("localhost", 15500))
val client = OkHttpClient.Builder()
.proxy(proxy)
.build()Retrofit
kotlin
val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("localhost", 15500))
val okHttpClient = OkHttpClient.Builder()
.proxy(proxy)
.build()
val retrofit = Retrofit.Builder()
.baseUrl("https://api.example.com")
.client(okHttpClient)
.build()Volley
kotlin
val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("localhost", 15500))
// Volley doesn't support proxy directly
// Use OkHttp or configure system-wideTroubleshooting
Certificate Not Trusted
- Check API Level: API 30+ requires system certificate or network security config
- Verify Installation: Settings → Security → Trusted Credentials → User
- App-Specific: Some apps may have certificate pinning
No Traffic Visible
- Verify Proxy: Check WiFi proxy settings
- ADB Reverse: Ensure
adb reversecommand succeeded - Port Conflict: Check port 15500 isn't used on device
HTTPS Errors
- Certificate Mismatch: Ensure using latest Glance CA
- Pinning: Some apps use certificate pinning (can't be intercepted)
- Old Cache: Clear app cache and restart
Certificate Pinning
Some apps (banking, security-focused) use certificate pinning and can't be intercepted:
- Root + Frida: Advanced users can bypass pinning
- Not Recommended: Bypassing pinning may violate ToS
- Alternative: Use API documentation instead
Production Apps vs Debug Builds
| Type | User Cert | System Cert | Network Config |
|---|---|---|---|
| Debug Build | ✅ Yes | ✅ Yes | ✅ Configurable |
| Release Build | ❌ No (API 30+) | ✅ Yes | ⚠️ If included |
| 3rd Party App | ❌ No (API 30+) | ✅ Yes | ❌ Can't modify |
Best Practices
- Use Emulator: Easier to configure and reset
- Debug Builds: Always test with debug builds during development
- Root When Needed: Consider rooted emulator for testing production apps
- Network Security Config: Always include for debug builds
Next Steps
- Client Configuration - Other platforms
- Troubleshooting - Common issues
- MCP Integration - Analyze mobile traffic with AI