-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Karn/develop
Release 0.0.5
- Loading branch information
Showing
24 changed files
with
676 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.karn.notify | ||
|
||
import android.app.NotificationChannel | ||
import android.app.NotificationManager | ||
import android.os.Build | ||
|
||
/** | ||
* Provides compatibility functionality for the Notification channels introduced in Android O. | ||
*/ | ||
internal object NotifyChannel { | ||
|
||
fun registerChannel(notificationManager: NotificationManager, channelKey: String, channelName: String, channelDescription: String, importance: Int = NotificationManager.IMPORTANCE_DEFAULT): Boolean { | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { | ||
return false | ||
} | ||
|
||
// Create the NotificationChannel, but only on API 26+ because | ||
// the NotificationChannel class is new and not in the support library | ||
val channel = NotificationChannel(channelKey, channelName, importance) | ||
|
||
channel.description = channelDescription | ||
// Register the channel with the system | ||
notificationManager.createNotificationChannel(channel) | ||
|
||
return true | ||
} | ||
} |
Oops, something went wrong.