[我正在尝试使用Google的Universal Music Player加PlayerNotificationManager
的代码播放一些音乐,该代码不是原始代码的一部分(但属于ExoPlayer 2)。
我的服务通过startForeground(...)
的回调正确完成了PlayerNotificationManager
:
playerNotificationManager.setNotificationListener(object : PlayerNotificationManager.NotificationListener {
override fun onNotificationStarted(notificationId: Int, notification: Notification?) {
startForeground(NOW_PLAYING_NOTIFICATION, notification)
}
override fun onNotificationCancelled(notificationId: Int) {
}
})
并且直到我将应用程序的主要活动放回去并且服务在几秒钟之内被杀死:],一切似乎都还可以。
2018-11-09 12:15:28.859 3680-3695/? W/ActivityManager: Stopping service due to app idle: u0a577 -1m19s332ms pl.qus.xenoamp2/pl.qus.xenoamp.xenoservice.MusicService
该服务通过使用正确启动
Util.startForegroundService(...)
那么可能有什么问题吗?
我正在尝试使用Google的Universal Music Player加上PlayerNotificationManager的代码来播放一些音乐,该代码不是原始代码的一部分(但属于ExoPlayer 2)。我的服务没有...
在回调onNotificationStarted
(或新引入的onNotificationPosted
)中,而不是使用