Skip to content

Foreground service that starts a counter with a notification displaying the incrementing number, handles permissions, and uses Kotlin coroutines and NotificationCompat for Android.

Notifications You must be signed in to change notification settings

js-bhavyansh/Foreground_Services

Repository files navigation

Foreground Counter Feature

Welcome to the Foreground Counter Feature repository! This project showcases a simple yet robust foreground service in an Android application that counts upwards continuously, even if the app is closed or removed from the background. The counting is controlled via two buttons: Start and Stop.

Features

  • Foreground Service: The counting is managed by a foreground service, ensuring that the count continues even when the app is not actively running.
  • Persistent Notification: When the counting starts, a persistent notification is displayed, showing the current count.
  • User Control: The user can start and stop the counting using dedicated buttons within the app.

How It Works

Start Counting

  • Click the Start button.
  • A notification appears with the current count.
  • The counter continues to increment every second, regardless of whether the app is in the foreground, background, or closed.

Stop Counting

  • Click the Stop button.
  • The counting stops, and the notification is dismissed.

Getting Started

Prerequisites

  • Android Studio installed on your computer.
  • An Android device or emulator to run the app.

Installation

1.> Clone the repository:

  git clone https://github.com/Bhavyansh03-tech/Foreground_Services.git

2.> Open the project in Android Studio.

3.> Build and run the app on your device or emulator.

Usage

1.> Start the App: Launch the application on your device.
2.> Start Counting: Press the Start button to initiate the counter.
3.> View Notification: Observe the notification showing the current count.
4.> Stop Counting: Press the Stop button to stop the counter and remove the notification.

Screenshots

WebToApp

Acknowledgements

  • Inspiration from various Android development tutorials and documentation.

Contact

For questions or feedback, please contact @Bhavyansh03-tech.

About

Foreground service that starts a counter with a notification displaying the incrementing number, handles permissions, and uses Kotlin coroutines and NotificationCompat for Android.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages