/MapApp

Primary LanguageJava

Location Tracker App

This project demonstrates a basic Android application that tracks a user's location, integrates with Firebase, and provides notifications using a BroadcastReceiver. It includes Google Maps integration using the Google Cloud Platform API.

Features Real-time location tracking. Google Maps integration. Firebase integration. Push notifications using BroadcastReceiver. Background services to track location updates. Step-by-Step Implementation Guide

  1. Add Dependency in Gradle Open your build.gradle (Module) file and add the following dependencies:

Sync your project after adding the dependencies.

  1. Design Main Activity In your MainActivity.java, design the UI to include a button to launch the MapsActivity. You can create a simple layout with a button using XML:

Set up an OnClickListener in MainActivity to start the MapsActivity.

  1. Create MapsActivity from Template Create a new MapsActivity from the Google Maps Activity template. To do this:

Right-click on your package in Android Studio. Select New -> Google -> Google Maps Activity. This will automatically generate MapsActivity.java and activity_maps.xml, along with the necessary configuration in AndroidManifest.xml. 4. Create Location Service To track the user’s location, create a background service called LocationService:

Create a new class LocationService.java. Use FusedLocationProviderClient to fetch the current location.

  1. Connect Account with Firebase Follow these steps to connect Firebase to your project:

Go to the Firebase Console. Create a new Firebase project and register your Android app. Download the google-services.json file and place it in the app/ directory. Add the Firebase SDK by modifying your project-level build.gradle:

  1. Create Google Cloud Platform Project for API Key Go to the Google Cloud Console. Create a new project and enable the Maps SDK for Android. Generate an API key and restrict it to your app’s package name. Add the API key to your AndroidManifest.xml:

  2. Create Broadcast Receiver and Application-Level Class for Notifications Create a BroadcastReceiver to handle notifications:

To set up application-wide notification handling, create an Application class:

In MyApplication.java:

Update the AndroidManifest.xml to declare the Application and BroadcastReceiver.

8. Add Required Permissions in Manifest Ensure you have the following permissions in your AndroidManifest.xml for location tracking and internet access:

If location services are required in the background, include: License This project is licensed under the MIT License - see the LICENSE file for details.