Production-oriented Android demo for real-time Vehicle-to-Vehicle (V2V) telemetry sharing and on-device trajectory prediction.
V2V App turns Android phones into cooperative vehicle nodes. Each node publishes local motion telemetry, discovers nearby peers, exchanges state at low latency, and runs local ML inference to predict short-horizon trajectory.
This is designed for demonstrations, prototyping, and field-style validation of multi-device V2V behavior.
- Real-time telemetry loop at
10 Hz(100 mscadence) - Peer discovery + connection using Google Nearby Connections (
P2P_CLUSTER) - Bi-directional state exchange (JSON payloads)
- On-device TensorFlow Lite inference (
vehicle_trajectory.tflite) - Premium multi-page live UI (cosmic/neon theme):
Dashboardtab: live radar + network telemetry + model summaryDevicestab: exact connected Nearby endpoint IDsCoordinatestab: exact30predicted(x, y)coordinates
- Kotlin + Android SDK (minSdk
26, targetSdk34) - Google Play Services Nearby (
play-services-nearby) - Google Play Services Location (
play-services-location) - TensorFlow Lite Runtime (
com.google.ai.edge.litert)
- Telemetry Ingestion
- GPS (
FusedLocationProviderClient) for position/speed - Device orientation (
TYPE_ROTATION_VECTOR) for heading - Linear acceleration (
TYPE_LINEAR_ACCELERATION) for acceleration magnitude
- V2V Networking Layer
- Every device advertises and discovers peers simultaneously
- Connection arbitration avoids dual connection races
- Local state broadcast to connected peers at
10 Hz - Peer tracks retained in bounded history buffers (
50states)
- Inference Layer
- Builds ego/node/edge tensors from recent history
- Runs TFLite model inference on-device
- De-normalizes output to world coordinates for rendering
- UI Layer
- Styled cosmic-metallic experience with animated glow accents
Dashboardpage for radar + health counters + output summaryDevicespage for exact connected endpoint IDsCoordinatespage for exact 30 live trajectory points
Required for full operation:
ACCESS_FINE_LOCATIONBLUETOOTH_SCAN(Android 12+)BLUETOOTH_CONNECT(Android 12+)BLUETOOTH_ADVERTISE(Android 12+)NEARBY_WIFI_DEVICES(Android 13+)
If denied, V2V discovery/exchange will not initialize.
Use 2+ Android phones (recommended 3-5 for stronger demo impact).
- Install the APK on all devices.
- Enable Bluetooth and Location on all devices.
- Keep devices within close proximity during discovery.
- Open app on each device and grant all requested permissions.
- Wait 5-20 seconds for discovery and connection handshake.
- Validate live network health in status text:
found > 0: peers discoveredconn > 0: active links establishedtx/rxcounters increasing: telemetry flowing
- Open
Devicestab to verify exact connected endpoint IDs. - Open
Coordinatestab to monitor exact 30 predicted points. - Move devices and observe live radar + prediction updates.
- Keep screens awake during demonstration to reduce background throttling.
- Prefer outdoor/open spaces for better GPS stability.
- Ensure Google Play Services is available/updated on test devices.
- Use consistent app version across all participating devices.
- Swipe across tabs during demo:
Dashboard: operational command viewDevices: connectivity validation viewCoordinates: model precision view
- No peers found (
found=0):- Check Bluetooth/Location enabled on all devices.
- Re-launch app on all nodes.
- Bring devices closer.
- No active connection (
conn=0):- Wait for discovery handshake; watch
errin status. - Confirm all runtime permissions are granted.
- Wait for discovery handshake; watch
- Prediction not updating:
- Verify telemetry is changing (move device).
- Check
rx/txcounters for data flow.
- Optimized for prototype/demo usage, not certified vehicular safety deployment.
- Uses mobile sensors and Nearby transport, so performance depends on device hardware and environment.
app/src/main/kotlin/com/aryan/v2v/MainActivity.kt- app orchestration loopsapp/src/main/kotlin/com/aryan/v2v/V2VManager.kt- Nearby networking + peer trackingapp/src/main/kotlin/com/aryan/v2v/TelemetryProvider.kt- sensor + location ingestionapp/src/main/kotlin/com/aryan/v2v/TrajectoryPredictor.kt- model input/output pipelineapp/src/main/kotlin/com/aryan/v2v/RadarView.kt- visualization layerapp/src/main/kotlin/com/aryan/v2v/ui/*- multi-tab premium UI fragments + adapters