Maps - Overview

 GPS

    • A satellite-based navigation system.
    • Constellation of satellites orbiting Earth at 20,000 km altitude.
    • Each satellite completes an orbit in 11 hours and 58 minutes.
    • Satellites continuously send signals to GPS receivers (e.g., mobile devices).
    • One-way communication—devices receive signals but do not send data back.
    • Devices calculate their position using trilateration, determining the distance to at least three satellites.
    • Multiple navigation systems exist; NAVSTAR is used by mobile phones.
    • Every point on Earth is covered by at least four satellites.
    • Accuracy: Typically 3 - 10 meters.

Latitude/ Longtitude

  • Units that represent geographical coordinates.
  • (0,0) = Equator & Prime Meridian intersection.
  • Geolocation: Process of determining coordinates (latitude/longitude).
  • Android provides Location API and Fused Location Provider (combining GPS, Wi-Fi, and sensors for better accuracy).

Google Maps - Camera Attributes

  • Google Maps represents a map view as a camera looking down on a flat plane. Key attributes:

    • Target (Location): The center of the map (Lat/Long).
    • Bearing (Orientation): The direction the map points relative to north (measured in degrees, clockwise).
    • Tilt (Viewing Angle):
      • Adjusting tilt gives a perspective view.
      • Nearby objects appear larger, distant ones appear smaller.
    • Zoom:
      • 0 = Entire world width is ~256 dpi.
      • Higher zoom levels show more details.

Adding Google Maps to an Android app

  • Uses Google Maps API to display maps similar to the Google Maps app.
  • Supports mobile devices, web services, and other platforms.
  • Google Maps Plugin: A wrapper around Google Maps API for Flutter, React Native, etc.
  • Automatically connects to Google Maps Servers for real-time updates.
  • User Interactions: Developers can enable map interaction and add markers.
  • Requires Google Play Services in Android Studio for enhanced features.
  • Uses Fused Location Provider for better accuracy.
  • Requires a Google API Key:
    • Register your app on the Google Developer website.
    • Add the API Key to the Android Manifest.
  • Use class onMapReadyCallBack - inherit

Fragment

  • Self-contained UI components within an Activity.
  • Can be combined into a single Activity or reused in multiple Activities.
  • Have their own lifecycle and can be added/removed dynamically.

Capture Users Location

  • Fused Location Provider:
    • Manages location sources (GPS, Wi-Fi, Cell Towers, Sensors).
    • Optimizes battery usage and accuracy based on app needs.
    • class LocationServices can be used
    • part of Google Play Services API
  • User Permission Requirements:
    • FINE_LOCATION: Uses GPS (high accuracy, more battery consumption).
    • COARSE_LOCATION: Uses Wi-Fi & Cell Towers (less accurate, lower battery usage).
    • If both permissions are granted, the app selects the best source automatically.



Comments

Popular posts from this blog

Android UI - Review Questions