我有需要即时更改的Chromecast接收器ID。
override fun getAdditionalSessionProviders(context: Context?): MutableList<SessionProvider>? {
return null
}
override fun getCastOptions(context: Context?): CastOptions {
val notificationOptions = NotificationOptions.Builder()
.setTargetActivityClassName(ExpandedControlsActivity::class.java.name)
.build()
val mediaOptions = CastMediaOptions.Builder()
.setNotificationOptions(notificationOptions)
.setExpandedControllerActivityClassName(ExpandedControlsActivity::class.java.name)
.build()
return CastOptions.Builder()
.setReceiverApplicationId(R.id.cast_id) // <-- This needs to be dynamic.
.setCastMediaOptions(mediaOptions)
.build()
}
}
我需要由测试人员动态更改它,最好是通过用户在文本字段上输入ID,然后重新启动应用程序来
。我可以使用构建变体对其进行更改,但理想情况下,我希望它是完全动态的。