最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Stop Continuous Notification sound in FCM Flutter - Stack Overflow

programmeradmin3浏览0评论
class CustomAudioPlayer {
  static AudioPlayer player = AudioPlayer();

  static void playRingtone() {
    player.play(AssetSource('noti.wav')); // Play the ringtone
    player.onPlayerComplete.listen((event) {
      log("Ringtone completed $test");
      player.play(AssetSource('noti.wav'));
    });
  }

  static void stopRingtone() {
    player.stop();
  }
}

@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  CustomAudioPlayer.playRingtone();
}

Upon getting notification, When I open app from background and click the button that calls

CustomAudioPlayer.stopRingtone();

but the notification sound is not stopping

Please help me out

发布评论

评论列表(0)

  1. 暂无评论