首页 > 解决方案 > 面向玩家的 Expo React 粘性通知

问题描述

我想为我的 android 音频播放器添加粘性通知并通过应用通知处理播放器,但我不知道该怎么做我尝试了 expo 官方通知文件但失败了,请在这种情况下帮助我。

useEffect(() => {
    async function body() {
      Notifications.dismissAllNotificationsAsync();

      const localNotification = {
        title: 'this.state.notifTitle',
        body: 'this.state.notifMessage',
        android: {
          sticky: true,
          priority: 'max',
        },
      };
      Notifications.presentLocalNotificationAsync(localNotification);
    }

    body();

   //  Notifications.addListener((n) => {
   //    console.log('notificationss', n);
   //  });
  }, []);

标签: androidaudio-playerexpo-avexpo-notifications

解决方案


推荐阅读