Skip to content

Commit 378cbfc

Browse files
committed
update README.MD
1 parent 62209e4 commit 378cbfc

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

Diff for: README.MD

+16-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ KNotify is a Kotlin library for sending native notifications across different op
88
- Simple, unified API for sending notifications
99
- Customizable notification title, message, and application icon
1010
- Automatic selection of the appropriate notifier based on the operating system
11+
- Application name customization for better identification
1112

1213
## Installation
1314

@@ -33,14 +34,15 @@ Here's a simple example of how to use KNotify:
3334
import com.kdroid.knotify.NotifierFactory
3435

3536
fun main() {
36-
val notifier = NotifierFactory.getNotifier()
37-
37+
val appName = "MyApp"
38+
val notifier = NotifierFactory.getNotifier(appName)
39+
3840
val title = "Hello from KNotify"
3941
val message = "This is a test notification"
4042
val appIcon = "/path/to/your/app/icon.png"
41-
43+
4244
val success = notifier.notify(title, message, appIcon)
43-
45+
4446
if (success) {
4547
println("Notification sent successfully")
4648
} else {
@@ -55,34 +57,38 @@ fun main() {
5557

5658
```kotlin
5759
interface Notifier {
58-
fun notify(title: String, message: String, appIcon: String): Boolean
60+
fun notify(title: String, message: String, appIcon: String?): Boolean
5961
}
6062
```
6163

6264
- `title`: The title of the notification
6365
- `message`: The message content of the notification
64-
- `appIcon`: The path to the application icon to display with the notification (Note: not supported on macOS)
66+
- `appIcon`: The path to the application icon to display with the notification (can be null)
6567
- Returns: `true` if the notification was successfully sent, `false` otherwise
6668

6769
### NotifierFactory
6870

6971
```kotlin
7072
object NotifierFactory {
71-
fun getNotifier(): Notifier
73+
fun getNotifier(appName: String): Notifier
7274
}
7375
```
7476

75-
- `getNotifier()`: Returns a platform-specific implementation of the `Notifier` interface based on the current operating system
77+
- `appName`: The name of the application sending the notification
78+
- Returns: A platform-specific implementation of the `Notifier` interface based on the current operating system
7679

7780
## Platform Support
7881

7982
- Linux: Uses `LinuxNotifier`
8083
- Windows: Uses `WindowsNotifier`
8184
- macOS: Uses `MacNotifier`
8285

83-
## Note
86+
Each platform-specific notifier is initialized with the provided `appName`.
87+
88+
## Notes
8489

85-
The `appIcon` parameter is not yet supported on macOS.
90+
- The `appIcon` parameter is optional (can be null) and is not yet supported on macOS.
91+
- An `UnsupportedOperationException` is thrown if the current operating system is not supported.
8692

8793
## Contributing
8894

0 commit comments

Comments
 (0)