Skip to content

orbitalsonic/Qibla-Compass-Sample-MVI-Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🕋 Qibla Compass MVI Android

A modern, production-ready Android Qibla Compass built using MVI Architecture, StateFlow, Sensors API, Location Services, and Clean Architecture.

This project demonstrates how to build a scalable and lifecycle-safe Qibla direction feature similar to premium Islamic applications.


✨ Features

✅ MVI Architecture

✅ StateFlow + Channel Effects

✅ Compass + Qibla Direction

✅ Accurate Kaaba Bearing Calculation

✅ Smooth Compass Rotation

✅ Sensor Lifecycle Handling

✅ GPS + Permission Handling

✅ Cached Location Support

✅ Device Orientation Detection

✅ Horizontal/Vertical Device Handling

✅ Qibla Found Detection

✅ ±5° Tolerance Detection

✅ Haptic Feedback / Vibration

✅ Low Pass Sensor Filtering

✅ Magnetic Sensor + Accelerometer

✅ XML + ViewBinding

✅ Modern Islamic UI

✅ Dark Mode Friendly

✅ Landscape Support

✅ Production Ready Structure


📸 Features Preview

🧭 Compass Features

  • Real-time compass rotation
  • Smooth needle animation
  • Qibla arrow rotation
  • Degree calculations
  • Kaaba direction alignment

📍 Location Features

  • Current location
  • Cached fallback location
  • GPS handling
  • Permission handling
  • Address integration

📱 Orientation Features

Vertical Device

When user holds phone vertically:

  • Compass hidden
  • Direction data hidden
  • Instruction shown:
Keep your phone flat for accurate Qibla direction

Horizontal Device

When phone becomes flat:

  • Compass visible
  • Qibla updates enabled
  • Sensor calculations resumed

🎯 Qibla Accuracy Detection

The app detects when the user is accurately facing Qibla.

Example:

Qibla Angle = 256°
Tolerance = ±5°

Valid Range:
251° → 261°

When inside tolerance:

✅ Vibrates once

✅ Shows “Qibla Found ✓”

✅ Highlights Qibla arrow

✅ Adds glow animation

When outside tolerance:

  • Removes highlight
  • Resets vibration state

📱 Screenshots

screen

🕌 Qibla Calculation

Uses accurate bearing calculation toward Kaaba coordinates:

Latitude: 21.4225
Longitude: 39.8262

Calculates:

  • azimuth
  • bearing
  • normalized direction
  • qibla alignment

Contributing

Contributions are welcome! Fork the repository, make changes, and submit a pull request.


License

This project is licensed under the MIT License. See the LICENSE file for details.

Copyright OrbitalSonic

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Releases

No releases published

Packages

 
 
 

Contributors

Languages