> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Braian551/viax/llms.txt
> Use this file to discover all available pages before exploring further.

# Trip Tracking

> Real-time GPS tracking and monitoring during your Viax trip

## Overview

Viax provides real-time GPS tracking for all trips, allowing you to monitor your journey from pickup to destination. This guide covers trip tracking features, safety options, and how to use the live map interface.

## Real-Time Tracking Features

<CardGroup cols={2}>
  <Card title="Live Map" icon="map">
    View your current location and route on an interactive map
  </Card>

  <Card title="Driver Location" icon="location-dot">
    See your driver's real-time position and movement
  </Card>

  <Card title="ETA Updates" icon="clock">
    Get accurate arrival time estimates updated continuously
  </Card>

  <Card title="Route Preview" icon="route">
    View the planned route and any deviations
  </Card>
</CardGroup>

## Trip Status Flow

Your trip progresses through several states, each providing different tracking information:

<Steps>
  <Step title="Searching for Driver">
    Status: `pendiente`

    * App searches for nearby available drivers
    * You see estimated wait time
    * Can cancel with no fee
  </Step>

  <Step title="Driver Assigned">
    Status: `aceptado`

    * Driver has accepted your request
    * See driver details (name, photo, rating, vehicle)
    * Track driver approaching your pickup location
    * View updated ETA

    ```dart theme={null}
    // Trip status update
    {
      "trip_id": "12345",
      "status": "aceptado",
      "driver": {
        "id": 67,
        "name": "Carlos Rodríguez",
        "rating": 4.8,
        "vehicle_type": "carro",
        "plate_number": "ABC123"
      },
      "driver_location": {
        "lat": 4.7110,
        "lng": -74.0721
      },
      "eta_minutes": 5
    }
    ```
  </Step>

  <Step title="Driver En Route">
    Status: `en_ruta`

    * Driver is on the way to pick you up
    * Live tracking of driver position
    * Distance and time to pickup
    * Can call or message driver
  </Step>

  <Step title="Trip In Progress">
    Status: `en_curso`

    * You're in the vehicle heading to destination
    * Route displayed on map
    * Live location updates
    * Share location with contacts
    * Estimated time to destination
  </Step>

  <Step title="Trip Completed">
    Status: `completado`

    * Arrived at destination
    * Final fare displayed
    * Rate your driver
    * View trip summary and receipt
  </Step>
</Steps>

## Live Map Interface

The trip tracking screen shows:

<Tabs>
  <Tab title="Map View">
    **Interactive Map Elements**

    * 🔵 Your location (blue marker)
    * 🚗 Driver location (car icon)
    * 📍 Pickup point (green marker)
    * 🏁 Destination (red marker)
    * 🛣️ Planned route (blue line)
    * 🚦 Traffic conditions (color-coded)

    The map auto-centers and follows the driver's movement in real-time.
  </Tab>

  <Tab title="Trip Details Card">
    **Bottom Sheet Information**

    * Driver name and photo
    * Vehicle type and plate number
    * Driver rating
    * Estimated arrival time
    * Distance remaining
    * Trip fare (estimated or final)
    * Contact options (call, message)
  </Tab>

  <Tab title="Actions">
    **Available Actions**

    * Share trip (location sharing)
    * Contact driver
    * Report issue
    * Emergency button (SOS)
    * Navigate to destination
    * Trip settings
  </Tab>
</Tabs>

## Location Updates

The app updates your location and the driver's location continuously:

```dart theme={null}
// Location update frequency
const locationUpdateInterval = Duration(seconds: 5);

// Geolocator settings for high accuracy
final locationSettings = LocationSettings(
  accuracy: LocationAccuracy.high,
  distanceFilter: 10, // Update every 10 meters
);

// Listen to location stream
positionStream = Geolocator.getPositionStream(
  locationSettings: locationSettings,
).listen((Position position) {
  // Update user location on map
  updateUserMarker(position);
  
  // Send location to backend for trip tracking
  if (tripStatus == TripStatus.inProgress) {
    sendLocationUpdate(position);
  }
});
```

## Navigation and Routing

During the trip, the app uses Mapbox for intelligent routing:

<Note>
  The route may change dynamically based on traffic conditions. Drivers can see traffic-aware navigation to optimize your trip time.
</Note>

**Routing Features:**

* Turn-by-turn navigation for drivers
* Traffic-aware route calculation
* Automatic rerouting if driver deviates
* Multiple route options
* Estimated time adjustments

## Safety Features

### Location Sharing

Share your trip in real-time with trusted contacts:

```dart theme={null}
// Create shareable trip link
final shareToken = await locationSharingService.createShareToken(
  tripId: currentTrip.id,
  expiresIn: Duration(hours: 2),
);

final shareUrl = 'https://viaxcol.online/share/$shareToken';

// Share via SMS, WhatsApp, or other apps
Share.share(
  'Following my Viax trip: $shareUrl',
  subject: 'Viax Trip Tracking',
);
```

See [Location Sharing](/users/location-sharing) for detailed information.

### Emergency Features

<CardGroup cols={2}>
  <Card title="SOS Button" icon="circle-exclamation">
    Quick access to emergency contacts and services
  </Card>

  <Card title="Trip Recording" icon="video">
    All trips are logged with GPS coordinates and timestamps
  </Card>

  <Card title="Driver Verification" icon="shield-check">
    Verified driver information shown before and during trip
  </Card>

  <Card title="Support Access" icon="headset">
    In-app support available during active trips
  </Card>
</CardGroup>

## Trip Information Panel

During the trip, access detailed information:

<Accordion title="Trip Details">
  * Trip ID
  * Start time
  * Pickup address
  * Destination address
  * Vehicle type
  * Current status
  * Distance traveled
  * Time elapsed
</Accordion>

<Accordion title="Driver Information">
  * Full name
  * Profile photo
  * Rating (out of 5 stars)
  * Number of completed trips
  * Vehicle make and model
  * License plate number
  * Contact options
</Accordion>

<Accordion title="Route Information">
  * Total distance
  * Estimated duration
  * Current speed
  * Traffic conditions
  * Alternative routes
  * Time remaining
</Accordion>

## Contacting Your Driver

You can communicate with your driver during the trip:

<Tabs>
  <Tab title="In-App Messaging">
    * Send text messages through the app
    * No phone number exchange required
    * Messages logged for safety
    * Quick message templates available
  </Tab>

  <Tab title="Phone Call">
    * Direct call to driver
    * Number masked for privacy
    * Call logs maintained
    * Available during active trip only
  </Tab>
</Tabs>

<Warning>
  For your safety, contact information is only available during an active trip and is masked to protect privacy.
</Warning>

## Notifications

Receive push notifications for trip updates:

* Driver assigned to your trip
* Driver approaching (2 minutes away)
* Driver arrived at pickup
* Trip started
* Approaching destination
* Trip completed
* Payment received
* Rating reminder

## Trip Completion

When you arrive at your destination:

<Steps>
  <Step title="Arrival confirmation">
    Driver marks trip as completed in their app
  </Step>

  <Step title="Final fare">
    View the final trip cost based on actual distance and time

    ```json theme={null}
    {
      "trip_id": "12345",
      "final_fare": {
        "base_fare": 4500,
        "distance_cost": 3200,
        "time_cost": 1800,
        "total": 9500,
        "currency": "COP"
      },
      "distance_km": 8.4,
      "duration_minutes": 18
    }
    ```
  </Step>

  <Step title="Payment">
    Complete payment if not already processed
  </Step>

  <Step title="Rating">
    Rate your driver (1-5 stars) and provide optional feedback
  </Step>

  <Step title="Receipt">
    Access your trip receipt and details in trip history
  </Step>
</Steps>

## Troubleshooting

<Accordion title="Map not loading">
  **Possible causes:**

  * No internet connection
  * GPS disabled
  * Map tiles not loading

  **Solutions:**

  * Check your internet connection
  * Enable location services
  * Restart the app
  * Clear app cache
</Accordion>

<Accordion title="Driver location not updating">
  **Possible causes:**

  * Driver's GPS is disabled
  * Poor network connectivity
  * App running in background

  **Solutions:**

  * Contact driver to check their GPS
  * Ensure app is in foreground
  * Refresh the trip screen
</Accordion>

<Accordion title="Incorrect ETA displayed">
  ETAs are estimates based on:

  * Current traffic conditions
  * Average speed
  * Route distance

  They update continuously as conditions change.
</Accordion>

## Next Steps

<CardGroup cols={2}>
  <Card title="Share Your Location" icon="share-nodes" href="/users/location-sharing">
    Learn how to share trip tracking with contacts
  </Card>

  <Card title="View Trip History" icon="clock-rotate-left" href="/users/ride-history">
    Access past trips and receipts
  </Card>
</CardGroup>

## Related API Endpoints

* [Get Trip Status](/api/trips/status)
* [Update Driver Location](/api/map/location-sharing)
* [Calculate Route](/api/map/routing)
