Greenride+ Navigation App Technical Documentation
1. Application Overview
Download App Download。
Greenride+ is a navigation application focused on green travel, supporting route planning for various transportation modes including walking, PMD (Personal Mobility Device), and car. The main features include route planning, carbon emission calculation, PMD station display, and trip recording, aiming to encourage users to choose low-carbon travel methods to reduce carbon emissions.
2. Application Usage
2.1 Main Interface
Users can select the start and end points on the main interface to plan routes.
2.2 Transportation Mode Selection
- The app supports three transportation modes: walking, PMD, and car
- Users can view routes, time, distance, and carbon emissions for each transportation mode in the selection interface
- Clicking on different transportation mode cards switches the view to the corresponding route
2.3 PMD Station Features
- PMD stations are displayed as markers on the map
- Clicking on a station marker shows station details
- Stations can be set as start or end points
2.4 Trip Recording
- Trip records are generated after completing navigation
- Records include start point, end point, transportation mode, distance, and carbon emission savings
- The app calculates cumulative carbon emission savings
3. Development Steps
3.1 Project Initialization
- Create Android project
- Configure basic development environment
- Add required dependencies
3.2 Amap Integration
- Apply for Amap API key
- Add map SDK dependencies
- Initialize map components
3.3 Route Planning Implementation
- Integrate Amap route planning service
- Implement walking, riding, and driving route calculations
- Design interaction methods for route selection
3.4 PMD Station Feature Development
- Design PMD station data structure
- Load station data from CSV file
- Implement station markers and info windows
3.5 Carbon Emission Calculation
- Define carbon emission coefficients for each transportation mode
- Implement carbon emission calculation based on distance
- Calculate carbon emission differences between transportation modes
3.6 Database Design and Implementation
- Design TripRecord model class
- Implement SQLite database helper class
- Develop data storage and query functions
3.7 User Interface Development
- Design main interface, transportation mode selection interface, report interface, etc.
- Implement interface interaction logic
- Optimize visual effects
4. Functional Modules in Detail
4.1 Map and Navigation Module
4.1.1 Map Display
- Use the
AMap
class to implement map display - Configure basic map settings (traffic display, zoom controls, compass, etc.)
- Implement map view adjustment features
aMap = mapView.getMap();
aMap.setTrafficEnabled(true);
aMap.getUiSettings().setZoomControlsEnabled(true);
aMap.getUiSettings().setCompassEnabled(true);
4.1.2 Route Planning
- Use the
RouteSearch
class to implement route search - Implement walking route calculation with
calculateWalkRouteAsyn
- Implement riding route calculation with
calculateRideRouteAsyn
(for PMD) - Implement driving route calculation with
calculateDriveRouteAsyn
4.1.3 Route Display
- Use the
Polyline
class to draw routes on the map - Set different colors based on transportation mode (walking: green, PMD: red, car: blue)
- Implement automatic route view adjustment
4.2 PMD Station Module
4.2.1 Station Data Management
- Custom
PMDStationMarker
class to store station information - Read station data from CSV file
- Manage station data loading and updates
4.2.2 Station Marker Display
- Use custom icons to mark PMD stations
- Implement marker click interaction
- Design info windows to display station details
4.2.3 Station Interaction Features
- Implement station information dialog
- Support setting stations as start or end points
- Update route planning to reflect station selection
4.3 Carbon Emission Calculation Module
4.3.1 Emission Coefficient Definition
private static final double EMISSION_WALKING = 0.0; // No carbon emissions for walking
private static final double EMISSION_PMD = 0.0135; // PMD: 0.0135kg per kilometer
private static final double EMISSION_CAR = 0.1848; // Car: 0.1848kg per kilometer
4.3.2 Emission Calculation Logic
- Walking emissions: 0 kg CO₂/km
- PMD emissions: 0.0135 kg CO₂/km
- Car emissions: 0.1848 kg CO₂/km
- Saved emissions calculated as the difference compared to car emissions
4.3.3 Interface Display
- Show carbon emissions for each transportation mode
- Calculate and display saved carbon emissions
- Show cumulative savings on the report page
4.4 Data Storage Module
4.4.1 Data Model Design
TripRecord
class: records trip information- Start point:
startPoint
- End point:
endPoint
- Transportation mode:
transportMode
- Distance:
distance
- Carbon emission savings:
carbonSaved
- Trip date:
tripDate
- Start point:
4.4.2 Database Design
- Use SQLite database
TripRecordDbHelper
class manages database operations- Table design: trips table contains all trip fields
4.4.3 Data Operations
- Save trip records:
saveTripRecord
method - Query trip records:
getAllTripRecords
method - Calculate total carbon savings:
getTotalCarbonSaved
method
4.5 User Interface Module
4.5.1 Main Interfaces
MainActivity
: Application main interfaceTransportModeActivity
: Transportation mode selection interfaceReportActivity
: Trip report interface
4.5.2 UI Component Design
- Use CardView to display transportation mode options
- Custom map markers and info windows
- Dynamic display of routes and information
4.5.3 Visual Effect Optimization
- Custom color scheme: primary color
#075E54
- Use Glide to load GIF animations
- Adaptive interface layout
5. Libraries and Versions
5.1 Core Android Libraries
- AndroidX Core: For basic component support
- AppCompat: Backward compatibility support
- ConstraintLayout: Build flexible UI layouts
- CardView: Implement card-style UI components
- RecyclerView: Display list data
5.2 Map-related Libraries
- Amap SDK: For map display and navigation functions
- Map SDK: Provides basic map functionality
- Search SDK: Implements location search and route planning
5.3 Image Processing Libraries
- Glide: For loading and displaying images and GIFs
- Version: Latest stable version
- Function: Load dynamic GIF images
5.4 Database Related
- Android SQLite: Built-in database support
- Purpose: Store trip records
- Implementation: Custom
TripRecordDbHelper
class
5.5 Other Utility Libraries
- ViewBinding: Simplify View access
- SharedPreferences: Store simple key-value data
- Android Logging: Development debugging logs
6. Development Considerations
6.1 Amap API Related
- Ensure correct API Key configuration
- Properly handle map lifecycle methods
- Set timeout handling for route planning requests
6.2 Data Type Conversion
- Pay attention to float and double type conversions, especially when calculating and passing distances
- Ensure distance values are correctly saved in trip records
6.3 Performance Optimization
- Avoid executing time-consuming operations on the UI thread
- Properly manage map resources to avoid memory leaks
- Batch process PMD station markers to reduce performance consumption
7. Future Feature Outlook
- Add support for more transportation modes
- Provide detailed trip history records and statistics
- Enhance social sharing features
- Optimize carbon emission calculation models
This document outlines the main features, development process, and technical details of the Greenride+ navigation application. Developers should refer to the specific code implementation for more detailed information.
GitHub Issues