Fixed Notification on Android O and later

This commit is contained in:
z3r0c00l-2k 2019-05-29 17:48:30 +05:30
parent b9213c75f7
commit 66f53d0b15
3 changed files with 6 additions and 4 deletions

View file

@ -10,8 +10,8 @@ android {
applicationId "io.github.z3r0c00l_2k.aquadroid"
minSdkVersion 21
targetSdkVersion 27
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {

View file

@ -60,6 +60,7 @@ class NotificationHelper(val ctx: Context) {
notificationsTone: String?
): Notification.Builder {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createChannels()
return Notification.Builder(ctx.applicationContext, CHANNEL_ONE_ID)
.setContentTitle(title)
.setContentText(body)
@ -82,10 +83,10 @@ class NotificationHelper(val ctx: Context) {
.setLargeIcon(
BitmapFactory.decodeResource(
ctx.resources,
io.github.z3r0c00l_2k.aquadroid.R.mipmap.ic_launcher
R.mipmap.ic_launcher
)
)
.setSmallIcon(io.github.z3r0c00l_2k.aquadroid.R.drawable.ic_small_logo)
.setSmallIcon(R.drawable.ic_small_logo)
.setAutoCancel(true)
notification.setShowWhen(true)

View file

@ -0,0 +1 @@
* Fixed notification on Android O and later