【问题标题】:Where set media style notification bar after recreation musicplayer app娱乐音乐播放器应用程序后在哪里设置媒体样式通知栏
【发布时间】:2019-07-28 22:15:39
【问题描述】:

我正在编写一个音乐播放器应用程序。更改主题颜色后,我重新创建 MainAcitivity。恢复完成后,我的播放器会继续播放上次播放的曲目。

MainActivity.getInstance().recreate();

我的应用程序使用 MediaBrowserService。在我的应用再次可供用户使用后,应将“暂停/播放”按钮设置为“暂停”,并设置进一步的操作 - 作为媒体样式通知。

我认为,由于捆绑对象 savedInstanceState,播放器会继续播放 - 但我没有在那里设置任何对象。

在哪里设置和放置状态以显示娱乐后通知栏的正确位置。

我使用本手册实现了 MediaBrowserService。 https://www.sitepoint.com/a-step-by-step-guide-to-building-an-android-audio-player-app/

感谢您的帮助。

【问题讨论】:

    标签: android android-mediaplayer lifecycle


    【解决方案1】:

    通过设置启动Service onStart()方法解决->

    Intent intent = new Intent(getmContext(),BackgroundAudioService.class); startService(intent);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多