Wrapped notification channel getter method in sdk if statement to fix notifications not arriving on Android 5-7

This commit is contained in:
Deniz Düzgören
2019-09-09 16:18:33 +02:00
parent 47a4a51b44
commit 48ec7f8829
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -10,8 +10,8 @@ android {
applicationId "com.denizd.substitutionplan" applicationId "com.denizd.substitutionplan"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 31 versionCode 32
versionName "2.2.8" versionName "2.2.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@@ -211,11 +211,11 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
val manager = mContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val manager = mContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
HelperFunctions.getNotificationChannel(mContext, prefs) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
HelperFunctions.getNotificationChannel(mContext, prefs)
}
val notification = NotificationCompat.Builder(mContext, val notification = NotificationCompat.Builder(mContext, HelperFunctions.notificationChannelId)
HelperFunctions.notificationChannelId
)
.setStyle(NotificationCompat.DecoratedCustomViewStyle()) .setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout) .setCustomContentView(notificationLayout)
.setSmallIcon(R.drawable.ic_avh) .setSmallIcon(R.drawable.ic_avh)