A simple Android application to track your current speed using GPS and visualize your location on a Google Map in real-time.
- 🚀 Real-time speed display (in MPH or KPH - configurable).
- 📍 Google Map showing your current location as you move.
- 📏 Distance tracking for the current trip.
- ⏱️ Option to start and stop tracking sessions.
- 📊 Displays maximum and average speed for the current trip.
- 🔋 Efficient GPS usage (within Android best practices).
- ✅ Runtime permissions handling for location access.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Android Studio installed.
- Android SDK (Target SDK and Compile SDK versions specified in
app/build.gradle
). - An Android device or emulator.
- A Google Cloud Platform account to obtain a Google Maps API key.
-
Clone the repository:
git clone https://github.com/Selvipr/SpeedTrackerPro.git cd SpeedTrackerPro
-
Open in Android Studio:
- Open Android Studio.
- Select "Open an existing Android Studio project".
- Navigate to the cloned directory and open it.
-
Obtain Google Maps API Key:
- Go to the Google Cloud Platform Console (https://console.cloud.google.com/).
- Create a new project (or select an existing one).
- Navigate to "APIs & Services" > "Library".
- Search for and enable the "Maps SDK for Android".
- Go to "APIs & Services" > "Credentials".
- Click "Create Credentials" and select "API Key".
- IMPORTANT: Restrict your API key to the "Maps SDK for Android" and add package name and SHA-1 signing certificate fingerprint restrictions for your app to prevent unauthorized usage. See Google's documentation for details.
- Copy your API key.
-
Add API Key to Project:
- Best Practice (Secure): Create a
local.properties
file in the root directory of your project (if it doesn't exist). Add it to your.gitignore
file. Add your API key like this:Then, in yourMAPS_API_KEY=YOUR_API_KEY_HERE
AndroidManifest.xml
file (usuallyapp/src/main/AndroidManifest.xml
), reference it:You'll need to ensure your<meta-data android:name="com.google.android.geo.API_KEY" android:value="${MAPS_API_KEY}" />
app/build.gradle
file reads this property. (This step can vary based on implementation, but referencing fromlocal.properties
is recommended for security). - Alternative (Less Secure): Directly paste the key into your
AndroidManifest.xml
(replace"YOUR_API_KEY"
):Warning: Avoid committing API keys directly into files tracked by Git. Use<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_API_KEY" />
local.properties
and.gitignore
.
- Best Practice (Secure): Create a
-
Sync Project: After adding the API key, sync your project with Gradle files (File -> Sync Project with Gradle Files).
- Connect your Android device or start an emulator.
- Ensure GPS/Location services are enabled on the device/emulator.
- In Android Studio, click the green 'Run' button (usually a triangle icon).
- Select your connected device or running emulator when prompted.
- The app should build and install on your device/emulator.
. ├── app/ │ ├── src/ │ │ ├── main/ │ │ │ ├── java/ (Your Kotlin/Java source code) │ │ │ ├── res/ (Layouts, drawables, values, etc.) │ │ │ └── AndroidManifest.xml │ ├── build.gradle (App module build file) ├── gradle/ ├── build.gradle (Project level build file) ├── settings.gradle ├── local.properties (Should be in .gitignore) └── .gitignore
(Adjust this structure tree if your project layout is significantly different)
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes and commit them (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Create a new Pull Request on GitHub.
Please ensure your code adheres to the project's coding style and includes appropriate tests if applicable.
This project is licensed under the MIT License - see the LICENSE file for details. (Make sure you have a LICENSE file in your repository)
- [Selvipr] - [https://github.com/Selvipr]