Auto Notifications SDK simplifies rendering notifications in Android apps, removing the need to write repetitive boilerplate code. This SDK supports default Android notification styles and allows for dynamic, server-configured notifications, enabling easier customization and management.
Android developers must manually write code for notification rendering and establish custom backend contracts. Android Notifications SDK provides a standardized approach that simplifies this process, helping developers save time, minimize errors, and streamline notification handling.
Add the SDK to your project by including the following in your build.gradle
:
dependencies {
implementation 'co.taggar:android-notifications:1.0.2'
}
TOML (for Gradle version catalogs):
[dependencies]
android-notifications-sdk = { group = "co.taggar", name = "android-notifications", version = "1.0.2" }
Add it to your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
or if you are using Kotlin scripts (.kts
) e.g. settings.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven ("https://jitpack.io" )
}
}
Please request the notification permissions POST_NOTIFICATIONS
as per your needs in newer Android versions.
https://developer.android.com/develop/ui/views/notifications/notification-permission
Please follow Firebase's guidelines for delivering the notifications, e.g., using Admin SDK or making an API call. https://firebase.google.com/docs/cloud-messaging/server
Make sure for the payload, you do not send the notification object, please send all the required fields in the data object.
As per the official documentation, all of the subfields sent in the data must be stringified as the data object is only available as Map<String, String>
{
"notification": null,
"data":{
"type": "ANDP"
"title": "Test Notification",
"body": "This is a normal notification."
}
}
The SDK will only process notifications with type
= ANDP
and ignore any other type of notification. The other notifications can be accessed by extending a Service to the AutoNotificationService
and having custom implementations like FirebaseNotificationService.
AutoNotificationService
can render almost all Android notifications out of the box. Please modify one of the following template objects to fit your needs.
- [Upcoming] Remove already sent notifications remotely from user's devices
- [Upcoming] Get callbacks notification clicks, and button clicks directly in the Kotlin listeners, rather than deep links
- [Upcoming] Notification Analytic callbacks e.g. Notification Received, Shown, Opened, Dismissed, etc
Contributions are welcome! Feel free to contribute on GitHub if you'd like to submit pull requests, report issues, or suggest features.