use the BigTextStyle notification style at received SMS

This commit is contained in:
tibbi 2020-04-04 22:11:23 +02:00
parent 1fe2f10d53
commit a3e89719b1
2 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.RingtoneManager
@ -64,6 +65,7 @@ class SmsReceiver : BroadcastReceiver() {
setBypassDnd(false)
enableLights(true)
setSound(soundUri, audioAttributes)
enableVibration(true)
notificationManager.createNotificationChannel(this)
}
}
@ -75,11 +77,14 @@ class SmsReceiver : BroadcastReceiver() {
}
val pendingIntent = PendingIntent.getActivity(context, threadID, intent, PendingIntent.FLAG_UPDATE_CURRENT)
val summaryText = context.getString(R.string.new_message)
val builder = NotificationCompat.Builder(context, channelId)
.setContentTitle(address)
.setContentText(body)
.setSmallIcon(R.drawable.ic_launcher_foreground)
.setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.ic_launcher_foreground))
.setStyle(NotificationCompat.BigTextStyle().setSummaryText(summaryText).bigText(body))
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_LIGHTS)

View File

@ -6,4 +6,5 @@
<!-- Notifications -->
<string name="channel_received_sms">Received SMS</string>
<string name="new_message">New message</string>
</resources>