Remove Polyline route drawing from map
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package com.rit.driver;
|
||||
|
||||
public class Config {
|
||||
// Replace this with your VPS public IP address or production domain name
|
||||
public static final String BACKEND_URL = "http://15.206.182.201:8085";
|
||||
// Local testing backend URL (Your PC Wi-Fi IP)
|
||||
public static final String BACKEND_URL = "http://10.10.15.91:8085";
|
||||
|
||||
// Default driver security PIN
|
||||
public static final String DEFAULT_PIN = "RITDRIVER";
|
||||
|
||||
@@ -133,18 +133,37 @@ public class TrackingService extends Service {
|
||||
Log.d(TAG, "WakeLock acquired successfully");
|
||||
}
|
||||
|
||||
// 3. Register GPS location listener
|
||||
// 3. Register Location Listeners (both GPS and Network for indoors/outdoors)
|
||||
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
try {
|
||||
if (locationManager != null) {
|
||||
// Request updates every 5 seconds (5000ms) or 2 meters
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.GPS_PROVIDER,
|
||||
5000,
|
||||
2.0f,
|
||||
locationListener
|
||||
);
|
||||
Log.d(TAG, "GPS Listener registered successfully");
|
||||
// Request GPS updates
|
||||
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.GPS_PROVIDER,
|
||||
5000,
|
||||
0.0f,
|
||||
locationListener
|
||||
);
|
||||
}
|
||||
// Request Network/Wi-Fi location updates (essential indoors)
|
||||
if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.NETWORK_PROVIDER,
|
||||
5000,
|
||||
0.0f,
|
||||
locationListener
|
||||
);
|
||||
}
|
||||
|
||||
// Immediately trigger initial fix if available
|
||||
Location lastGps = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
Location lastNet = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
Location bestLocation = (lastGps != null) ? lastGps : lastNet;
|
||||
if (bestLocation != null) {
|
||||
locationListener.onLocationChanged(bestLocation);
|
||||
}
|
||||
Log.d(TAG, "Location Listeners registered successfully");
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
Log.e(TAG, "SecurityException: Location permissions not granted", e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { MapContainer, TileLayer, Marker, Popup, Polyline, useMap } from 'react-leaflet';
|
||||
import { MapContainer, TileLayer, Marker, Popup, useMap } from 'react-leaflet';
|
||||
import L from 'leaflet';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import type { BusRoute } from '@/types';
|
||||
@@ -289,14 +289,6 @@ export default function BusRouteMap({ selectedRoute, allRoutes }: BusRouteMapPro
|
||||
);
|
||||
})}
|
||||
|
||||
{selectedRoute && pathCoordinates.length > 1 && (
|
||||
<Polyline
|
||||
positions={pathCoordinates}
|
||||
color={selectedRoute.color || "#F97316"}
|
||||
weight={4}
|
||||
opacity={0.8}
|
||||
/>
|
||||
)}
|
||||
|
||||
<MapUpdater bounds={mapBounds} />
|
||||
</MapContainer>
|
||||
|
||||
Reference in New Issue
Block a user