> ## 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.

# Notifications

> Manage push notifications, sound alerts, and trip request notifications

## Overview

Viax uses notifications to keep you informed about trip requests, earnings, and important updates. Configure your notification preferences to ensure you never miss an opportunity while avoiding unnecessary interruptions.

## Notification Types

<CardGroup cols={2}>
  <Card title="Trip Requests" icon="bell">
    New trip requests from nearby passengers
  </Card>

  <Card title="Trip Updates" icon="route">
    Status changes during active trips
  </Card>

  <Card title="Earnings" icon="dollar-sign">
    Payment confirmations and earnings updates
  </Card>

  <Card title="System Alerts" icon="circle-exclamation">
    Account updates, document expiration, important messages
  </Card>
</CardGroup>

## Push Notifications

Push notifications appear even when the app is in the background:

### Trip Request Notifications

When a passenger requests a trip near you:

```dart theme={null}
// Push notification payload
{
  "type": "new_trip_request",
  "trip_id": "12345",
  "pickup_address": "Calle 72 #10-34",
  "destination_address": "Carrera 15 #85-23",
  "distance_to_pickup": 1.2,
  "estimated_fare": 12500,
  "passenger_rating": 4.8,
  "expires_in": 30
}
```

<Note>
  Trip requests expire after 30 seconds. Enable sound and vibration to ensure you don't miss requests.
</Note>

### Notification Actions

Trip request notifications include quick actions:

* **Accept**: Accept the trip immediately
* **Decline**: Reject this trip request
* **View**: Open app to see full details

## Sound Alerts

Viax includes audio notifications for critical events:

<Tabs>
  <Tab title="Trip Request Sound">
    **Custom notification sound for new trips**

    Located in: `assets/sounds/`

    Features:

    * Distinctive alert tone
    * Repeats 3 times
    * Plays even in silent mode (if configured)
    * Volume adjustable in settings

    <Info>
      The trip request sound is different from other notifications so you can instantly recognize new opportunities.
    </Info>
  </Tab>

  <Tab title="Other Sounds">
    **Additional audio alerts:**

    * Trip accepted confirmation
    * Trip started
    * Trip completed
    * Payment received
    * Passenger arrived
    * Navigation updates
  </Tab>
</Tabs>

### Configuring Sounds

<Steps>
  <Step title="Open settings">
    Go to **Settings** > **Notifications** > **Sounds**
  </Step>

  <Step title="Enable trip request sound">
    Toggle **Trip Request Sound** on/off
  </Step>

  <Step title="Adjust volume">
    Set notification volume (0-100%)
  </Step>

  <Step title="Test sound">
    Tap **Test Sound** to preview
  </Step>
</Steps>

## Notification Settings

### Trip Notifications

<Accordion title="New Trip Requests">
  * Push notification
  * Sound alert
  * Vibration
  * Lock screen notification
  * Heads-up notification (Android)

  **Cannot be disabled** (required for driver operation)
</Accordion>

<Accordion title="Trip Status Updates">
  * Passenger confirmed pickup
  * Passenger cancelled
  * Navigation updates
  * Destination approaching

  **Recommended**: Keep enabled
</Accordion>

<Accordion title="Passenger Communication">
  * New message from passenger
  * Passenger called
  * Passenger shared additional info

  **Required for good service**
</Accordion>

### Earnings Notifications

<Accordion title="Payment Notifications">
  * Trip payment received
  * Weekly payout processed
  * Bonus achieved
  * Referral bonus earned

  **Customizable**: Enable/disable as preferred
</Accordion>

### System Notifications

<Accordion title="Account & Documents">
  * Document expiring soon (30, 15, 7 days)
  * Document expired
  * Account status changed
  * Profile update required

  **Important**: Keep enabled to stay compliant
</Accordion>

<Accordion title="Platform Updates">
  * App updates available
  * New features announced
  * Service area changes
  * Rate changes

  **Optional**: Can be customized
</Accordion>

## Firebase Cloud Messaging

Viax uses Firebase for push notifications:

```dart theme={null}
// Firebase messaging setup from source
import 'package:firebase_messaging/firebase_messaging.dart';

class NotificationService {
  final FirebaseMessaging _messaging = FirebaseMessaging.instance;
  
  Future<void> initialize() async {
    // Request permission
    await _messaging.requestPermission(
      alert: true,
      badge: true,
      sound: true,
    );
    
    // Get FCM token
    final token = await _messaging.getToken();
    
    // Send token to backend
    await registerDeviceToken(token);
    
    // Handle foreground messages
    FirebaseMessaging.onMessage.listen(_handleForegroundMessage);
    
    // Handle background messages
    FirebaseMessaging.onBackgroundMessage(_backgroundMessageHandler);
  }
}
```

## Notification Permissions

Ensure notifications are enabled:

<Tabs>
  <Tab title="Android">
    1. Open **Settings** on your device
    2. Go to **Apps** > **Viax**
    3. Tap **Notifications**
    4. Enable **All Viax notifications**
    5. Allow **Override Do Not Disturb** for trip requests
  </Tab>

  <Tab title="iOS">
    1. Open **Settings** on your device
    2. Go to **Notifications**
    3. Select **Viax**
    4. Enable **Allow Notifications**
    5. Enable **Sounds**, **Badges**, and **Banners**
    6. Set **Banner Style** to **Persistent** for trip requests
  </Tab>
</Tabs>

<Warning>
  Without proper notification permissions, you will not receive trip requests and cannot operate as a driver.
</Warning>

## Do Not Disturb Mode

Configure DND to allow critical notifications:

### Android

* Go to **Settings** > **Do Not Disturb**
* Add **Viax** to priority apps
* Allow alarms and priority notifications

### iOS

* Go to **Settings** > **Focus** > **Do Not Disturb**
* Add **Viax** to allowed apps
* Enable **Time Sensitive Notifications**

## Local Notifications

For scheduled reminders and offline alerts:

```dart theme={null}
// Local notifications for offline scenarios
import 'package:flutter_local_notifications/flutter_local_notifications.dart';

class LocalNotificationService {
  final FlutterLocalNotificationsPlugin _plugin = 
      FlutterLocalNotificationsPlugin();
  
  Future<void> scheduleDocumentExpiry(
    DateTime expiryDate,
    String documentType,
  ) async {
    // Schedule 30 days before
    await _plugin.zonedSchedule(
      0,
      'Document Expiring Soon',
      'Your $documentType expires in 30 days',
      expiryDate.subtract(Duration(days: 30)),
      platformChannelSpecifics,
      uiLocalNotificationDateInterpretation:
          UILocalNotificationDateInterpretation.absoluteTime,
    );
  }
}
```

## Notification Channels (Android)

Different notification types use different channels:

| Channel       | Priority | Sound | Vibration | Importance |
| ------------- | -------- | ----- | --------- | ---------- |
| Trip Requests | Urgent   | Yes   | Yes       | High       |
| Trip Updates  | High     | Yes   | No        | High       |
| Earnings      | Default  | No    | No        | Default    |
| System Alerts | High     | Yes   | No        | High       |
| Marketing     | Low      | No    | No        | Low        |

## Troubleshooting

<Accordion title="Not receiving trip requests">
  **Check:**

  1. Notification permissions enabled
  2. App not in battery saver mode
  3. Internet connection active
  4. You're online and available
  5. Sound/vibration enabled

  **Fix:**

  * Go to device Settings > Apps > Viax
  * Enable all notification permissions
  * Disable battery optimization for Viax
  * Restart the app
</Accordion>

<Accordion title="No notification sound">
  **Check:**

  1. Device not in silent mode
  2. Notification volume not muted
  3. Sound enabled in Viax settings
  4. Sound file not corrupted

  **Fix:**

  * Increase device volume
  * Test sound in app settings
  * Reinstall app if sound missing
</Accordion>

<Accordion title="Notifications delayed">
  **Causes:**

  * Poor internet connection
  * Battery saver mode active
  * Background data restricted
  * FCM service issues

  **Solutions:**

  * Check internet connection
  * Disable battery optimization
  * Allow background data
  * Update Google Play Services (Android)
</Accordion>

## Best Practices

<CardGroup cols={2}>
  <Card title="Keep Volume Up" icon="volume-high">
    Ensure notification volume is at least 50% when driving
  </Card>

  <Card title="Enable Vibration" icon="mobile">
    Use vibration as backup if sound fails
  </Card>

  <Card title="Test Regularly" icon="vial">
    Test notifications weekly to ensure they work
  </Card>

  <Card title="Update App" icon="arrow-up">
    Keep app updated for latest notification features
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Accepting Rides" icon="check" href="/drivers/accepting-rides">
    Learn how to respond to trip requests
  </Card>

  <Card title="Availability Status" icon="toggle-on" href="/drivers/availability-status">
    Manage your online/offline status
  </Card>
</CardGroup>
