Reputation: 3478
I am trying to load image from a remote url in NotificationCompat.MessagingStyle.Message.setData()
method.
Code is like this
val senderImg = Picasso.with(this).load(senderAvatar).get()
val sndr = Person.Builder()
.setName(senderName)
.setIcon(IconCompat.createWithBitmap(senderImg))
.build()
bldr = NotificationCompat.Builder(this, id)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(pendingIntent)
.setPriority(NotificationManager.IMPORTANCE_DEFAULT)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(title)
.setAutoCancel(true)
val imageUri = Uri.parse(imageUrl)
mssg = NotificationCompat.MessagingStyle.Message(
msg,
Date().time, sndr
).setData("image/", "https://i.imgur.com/wrv4Ngp.jpg")
NotificationCompat.MessagingStyle(sndr)
.addMessage(mssg)
.setBuilder(bldr)
NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, bldr.build())
But the image is not displaying. Any help would be appreciated. Thanks
Upvotes: 1
Views: 668