Skip to main content

Overview

Viax’s location sharing feature allows you to share your real-time trip location with trusted contacts. This safety feature gives your friends and family peace of mind by letting them track your journey from pickup to destination.

Why Share Your Location

Safety

Let others know where you are during your trip

Coordination

Help others know when you’ll arrive

Peace of Mind

Give your family assurance during travel

Accountability

Additional layer of security and transparency

How Location Sharing Works

Location sharing creates a unique, time-limited link that displays your trip on a live map:
1

Start your trip

Book and begin your Viax trip as normal
2

Tap share icon

During the trip, tap the share location button in the tracking screen
3

Choose sharing method

Share via WhatsApp, SMS, email, or copy link
// Generate share token
final shareToken = await locationSharingService.createToken(
  tripId: currentTrip.id,
  expiresIn: Duration(hours: 2),
);

final shareUrl = AppConfig.buildShareUrl(shareToken);
// https://viaxcol.online/share/abc123xyz
4

Recipients view live map

Anyone with the link can view your real-time location
5

Auto-expiration

Link expires automatically after trip completion or 2 hours
The app generates a secure, temporary share link:
// Location sharing implementation
class LocationSharingService {
  Future<String> createShareToken({
    required String tripId,
    Duration expiresIn = const Duration(hours: 2),
  }) async {
    final token = _generateSecureToken();
    
    final response = await http.post(
      Uri.parse('${AppConfig.baseUrl}/location_sharing/create.php'),
      body: {
        'trip_id': tripId,
        'token': token,
        'expires_in': expiresIn.inSeconds.toString(),
      },
    );
    
    if (response.statusCode == 200) {
      return token;
    }
    throw Exception('Failed to create share token');
  }
}

What Recipients See

When someone opens your share link, they see:
  • Your current location (updated every 5 seconds)
  • Pickup point
  • Destination
  • Planned route
  • Driver location
  • Vehicle information
Recipients don’t need the Viax app installed - the share link opens in any web browser.
The location share URL contains:
https://viaxcol.online/share/{share_token}

Example:
https://viaxcol.online/share/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

Token Components

{
  "trip_id": "12345",
  "user_id": "67",
  "expires_at": "2024-03-05T16:30:00Z",
  "permissions": ["view_location", "view_trip_details"]
}

Sharing Methods

Multiple ways to share your trip:
I'm on a Viax trip. Track my location:
https://viaxcol.online/share/abc123

From: Calle 72 #10-34
To: Carrera 15 #85-23
ETA: 15 minutes
  • Instant delivery
  • Most popular in Colombia
  • Read receipts
  • Group sharing option
Following my Viax trip:
https://viaxcol.online/share/abc123
  • Works on any phone
  • No app required
  • Reliable delivery
  • Good for emergencies
Subject: Track My Viax Trip
Hi,

I'm currently on a Viax trip. You can track my location here:
https://viaxcol.online/share/abc123

Pickup: Calle 72 #10-34, Bogotá
Destination: Carrera 15 #85-23, Bogotá
ETA: 3:45 PM

This link expires in 2 hours.

Privacy and Security

Temporary Links

Share links expire automatically after trip completion

Unique Tokens

Each share creates a unique, non-guessable token

No Personal Data

Recipients only see trip details, not your personal information

Revocable

Stop sharing anytime by ending the trip

What’s Not Shared

  • Your phone number
  • Email address
  • Payment information
  • Past trip history
  • Saved addresses
  • Other personal data

Real-Time Updates

The share page updates your location automatically:
// Share page auto-refresh
setInterval(async () => {
  const tripData = await fetch(
    `https://api.viax.com/location_sharing/${token}`
  ).then(r => r.json());
  
  // Update marker position
  updateUserMarker(tripData.current_location);
  updateDriverMarker(tripData.driver_location);
  updateETA(tripData.estimated_arrival);
  updateTripStatus(tripData.status);
}, 5000); // Every 5 seconds
Location updates every 5 seconds to provide real-time tracking without excessive data usage.

Share Page Features

The web-based share page includes:

Interactive Map

  • Zoom and pan controls
  • Full screen option
  • Traffic layer toggle
  • Satellite view
  • Route visualization

Trip Progress

  • Progress bar showing % complete
  • Distance traveled vs remaining
  • Time elapsed vs ETA
  • Current speed (optional)

Emergency Contact

  • Quick access to emergency services
  • Contact Viax support
  • Report issue button

Use Cases

Share your location when traveling alone at night for added safety and peace of mind.

Managing Active Shares

View and manage your location shares:
// View active shares
final activeShares = await locationSharingService.getActiveShares();

for (final share in activeShares) {
  print('Token: ${share.token}');
  print('Trip: ${share.tripId}');
  print('Expires: ${share.expiresAt}');
  print('Views: ${share.viewCount}');
}

// Revoke a share
await locationSharingService.revokeToken(token);

Expiration and Cleanup

Share links expire automatically:
  • Trip completion: Immediate expiration
  • Time limit: 2 hours maximum
  • Manual revocation: Anytime via app
  • Trip cancellation: Immediate expiration
After expiration, the share link will show “This trip has ended” and no longer display location data.

Technical Implementation

Database Schema

CREATE TABLE location_shares (
  id INT PRIMARY KEY AUTO_INCREMENT,
  token VARCHAR(255) UNIQUE NOT NULL,
  trip_id INT NOT NULL,
  user_id INT NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  expires_at TIMESTAMP NOT NULL,
  view_count INT DEFAULT 0,
  last_viewed_at TIMESTAMP,
  active BOOLEAN DEFAULT TRUE,
  FOREIGN KEY (trip_id) REFERENCES viajes(id),
  FOREIGN KEY (user_id) REFERENCES users(id),
  INDEX idx_token (token),
  INDEX idx_trip (trip_id)
);

API Endpoints

Location sharing uses these endpoints:
  • POST /location_sharing/create - Generate share token
  • GET /location_sharing/{token} - Get trip data for token
  • DELETE /location_sharing/{token} - Revoke share
  • GET /location_sharing/active - List user’s active shares
See Location Sharing API for details.

Best Practices

Share Selectively

Only share with people you trust

Use for Safety

Always share location for night trips

Verify Expiration

Check that links expire after trip

Test the Feature

Try sharing with yourself first

Troubleshooting

Possible causes:
  • GPS disabled on your device
  • App in background
  • Poor network signal
Solutions:
  • Ensure GPS is enabled
  • Keep app in foreground during trip
  • Check your data connection

Future Enhancements

Planned improvements to location sharing:
  • Multiple simultaneous shares
  • Custom expiration times
  • Share templates with pre-written messages
  • Integration with emergency contacts
  • Share history and analytics
  • QR code generation for easy sharing

Next Steps

Trip Tracking

Learn about in-app trip tracking features

Safety Features

Explore other safety and security features

Build docs developers (and LLMs) love