Skip to content

rafalstanczuk/contentobserverservice

Repository files navigation

Content Observer Service

An Android application that demonstrates SMS monitoring and data synchronization capabilities for educational and portfolio purposes.

⚠️ Disclaimer

This project is for educational and portfolio purposes only. It demonstrates Android development concepts including background services, content observers, and data synchronization. Please ensure compliance with local laws and regulations when handling SMS data.

📱 Overview

Content Observer Service is an Android application that monitors incoming and outgoing SMS messages, stores them in a local SQLite database cache, and synchronizes the data when network connectivity is available. The application showcases various Android development patterns including:

  • Background service implementation
  • Content observer for SMS monitoring
  • SQLite database management
  • Network state monitoring
  • Email integration for data transmission
  • Permission handling for modern Android versions

🚀 Features

  • SMS Monitoring: Automatically captures incoming and outgoing SMS messages
  • Local Caching: Stores SMS data in SQLite database for offline access
  • Smart Synchronization: Sends cached data only when:
    • Network connectivity is available
    • Cache reaches a specified number of rows
  • Background Processing: Runs as a foreground service for reliable operation
  • Boot Persistence: Automatically starts after device reboot
  • Modern Permissions: Handles Android 13+ notification permissions and Android 14+ foreground service requirements

🛠️ Technical Details

Target Platform

  • Minimum SDK: Android 10 (API 29)
  • Target SDK: Android 15 (API 35)
  • Build Tools: 30.0.3

Key Components

Services

  • ContentObserverService: Main foreground service handling SMS monitoring
  • BootBroadcastReceiver: Ensures service starts after device reboot

Activities

  • ContentActivity: Main application interface
  • PermissionActivity: Handles runtime permission requests

SMS Management

  • SmsListener: Monitors SMS content changes
  • SmsCache: Manages SQLite database operations
  • SmsContentFilter: Filters and processes SMS data

Utilities

  • NetworkUtil: Network connectivity monitoring
  • PermissionHelper: Runtime permission management
  • PhoneInformationDeliverer: Device information collection
  • MailComposer: Email integration for data transmission

Permissions Required

The application requires several permissions to function properly:

  • SMS Permissions: RECEIVE_SMS, READ_SMS, SEND_SMS
  • Network Permissions: INTERNET, ACCESS_NETWORK_STATE
  • Phone State: READ_PHONE_STATE, READ_PHONE_NUMBERS
  • Contacts: READ_CONTACTS
  • System: RECEIVE_BOOT_COMPLETED
  • Storage: WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE (Android 10-13)
  • Notifications: POST_NOTIFICATIONS (Android 13+)
  • Foreground Service: FOREGROUND_SERVICE, FOREGROUND_SERVICE_DATA_SYNC (Android 14+)

📦 Dependencies

  • AndroidX Core: 1.12.0
  • AndroidX AppCompat: 1.6.1
  • JavaMail: For email functionality
  • Apache Commons Net: For network utilities

🔧 Installation & Setup

  1. Clone the repository:

    git clone <repository-url>
    cd ContentObserverService
  2. Open in Android Studio:

    • Import the project
    • Sync Gradle files
    • Ensure Android SDK 29+ is installed
  3. Configure Email Settings:

    • Update values.xml with valid email credentials
    • Configure SMTP settings for data transmission
  4. Build and Install:

    ./gradlew assembleDebug

📋 Usage

  1. Install the application on an Android device
  2. Grant required permissions when prompted
  3. Configure email settings in the application
  4. The service will automatically start monitoring SMS messages
  5. Cached data will be synchronized when network conditions are met

🏗️ Architecture

The application follows a modular architecture with clear separation of concerns:

app/src/main/java/system/widget/
├── ContentObserverService.java    # Main service
├── ContentActivity.java           # Main UI
├── PermissionActivity.java        # Permission handling
├── BootBroadcastReceiver.java     # Boot receiver
├── mail/                          # Email functionality
├── SmsContent/                    # SMS processing
└── utils/                         # Utility classes

🔒 Security & Privacy

  • Local Storage: All SMS data is stored locally in SQLite
  • Encrypted Transmission: Email transmission uses secure protocols
  • Permission Management: Implements proper runtime permission handling
  • Data Minimization: Only necessary data is collected and transmitted

📝 License

This project is licensed under the GNU General Public License v3.0. See the LICENSE.txt file for details.

👨‍💻 Author

Rafał Stańczuk
Email: stanczuk.rafal@gmail.com
Repository: https://github.com/rafalstanczuk/contentobserverservice

🚧 Future Enhancements

  • OAuth integration for enhanced security
  • Cloud storage integration
  • Advanced filtering options
  • Data encryption improvements
  • Modern UI/UX design

🤝 Contributing

This is an educational project. Contributions are welcome for learning purposes. Please ensure any modifications maintain the educational nature of the project.

⚠️ Important Notes

  • This application requires significant permissions that may trigger security warnings
  • SMS monitoring capabilities should be used responsibly and in compliance with local laws
  • The application is designed for educational purposes and should not be used for malicious activities
  • Always respect user privacy and data protection regulations

About

This project is for educational and portfolio purposes only. It demonstrates Android development concepts including background services, content observers, and data synchronization. Please ensure compliance with local laws and regulations when handling SMS data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages