- Notifications
You must be signed in to change notification settings - Fork12
Android library that simplifies creating & showing app notifications.
License
NotificationsYou must be signed in to change notification settings
isradeleon/Notify-Android
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Android library that simplifies creating & showing app notifications. Change the notification's icon or add a circular image or a picture to the notification using the Notify class.
Add jitpack.io to your root build.gradle:
allprojects { repositories {... maven { url'https://jitpack.io' } }}
Include the dependency in your app build.gradle:
dependencies { implementation'com.github.isradeleon:Notify-Android:1.0.5'// updated for Android X}
You may need to add the default notification channel to your app/res/values/strings.xml file:
<resources> <stringtranslatable="false"name="notify_channel_id">MyDefaultChannelID</string> <stringtranslatable="false"name="notify_channel_name">MyDefaultChannelName</string> <stringtranslatable="false"name="notify_channel_description">MyDefaultChannelDescription</string></resources>
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {Notify.build(getApplicationContext())/* * Set notification title and content * */ .setTitle("Jill Zhao") .setContent("Hi! So I meet you today?")/* * Set small icon from drawable resource * */ .setSmallIcon(R.drawable.ic_notifications_none_white_24dp) .setColor(R.color.colorPrimary)/* * Set notification large icon from drawable resource or URL * (make sure you added INTERNET permission to AndroidManifest.xml) * */ .setLargeIcon("https://images.pexels.com/photos/139829/pexels-photo-139829.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=150&w=440")/* * Circular large icon * */ .largeCircularIcon()/* * Add a picture from drawable resource or URL * (INTERNET permission needs to be added to AndroidManifest.xml) * */ .setPicture("https://images.pexels.com/photos/1058683/pexels-photo-1058683.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940") .show();// Show notification}
Method | Description |
---|---|
Notify.build(context) | Create a Notify object |
setId(id) | Set the identifier for the notification |
setTitle(title) | Set the notification title |
setContent(content) | Set the notification content |
setImportance(importance) | Handle the importance with NotifyImportance |
setLargeIcon(largeIcon) | Set the large icon from a drawable or URL resource |
largeCircularIcon() | Make large icon circular |
setSmallIcon(smallIcon) | Set the small icon from a drawable resource |
setPicture(picture) | Set a picture from a drawable or URL resource |
setChannelId(id) | Set the notification channel id |
setChannelName(name) | Set the notification channel name |
setChannelDescription(description) | Set the notification channel description |
setAutoCancel(autoCancel) | Set the auto-cancel value |
setAction(intent) | Set the action for when user clicks the notification |
enableVibration(vibration) | Enable or disable the vibration |
setVibrationPattern(vibrationPattern) | Set the vibration pattern |
getNotificationBuilder() | Return the native NotificationCompat.Builder object |
show() | Show the notification |
cancel(context, id) | Cancel the specified notification by id |
cancelAll(context) | Cancel all notifications |
This library is licensed underMIT license
. Viewlicense.
About
Android library that simplifies creating & showing app notifications.
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published