I was wondering if it would be possible to pass a lambda to Intent in kotlin, since lambdas are Serializable, but with this code I am getting error when creating a PendingIntent.
val bundle = bundleOf(ACTION to { pause() })
val playButtonIntent = Intent(this, MusicService::class.java).apply {
putExtras(bundle)
}
val pendingPlayIntent = PendingIntent.getService(this, 1, playButtonIntent, 0)
error:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object