React native 远程交互式推送通知-如何?

React native 远程交互式推送通知-如何?,react-native,push-notification,expo,React Native,Push Notification,Expo,TL;DR我如何通过世博会的推送API发送交互式通知 请提供下列资料: SDK版本:40 平台(Android/iOS/web/all):全部 使用以下代码,我创建了一个类别,并使用getNotificationCategoriesAsync,确认了它的存在 import Constants from "expo-constants"; import * as Notifications from "expo-notifications"; // Set

TL;DR我如何通过世博会的推送API发送交互式通知

请提供下列资料:

SDK版本:40 平台(Android/iOS/web/all):全部 使用以下代码,我创建了一个类别,并使用
getNotificationCategoriesAsync
,确认了它的存在

import Constants from "expo-constants";
import * as Notifications from "expo-notifications";

// Set up Category
  Notifications.setNotificationCategoryAsync("basic", [
    { identifier: "Yes", buttonTitle: "Yes You were really close, the experienceId and category are joined with a hyphen "-". Looking at the source code on iOS you can see the format string:

https://github.com/expo/expo/blob/fd47709156ed218cd5a8c5093df113918bdb2700/ios/versioned-react-native/ABI40_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI40_0_0EXScopedNotificationBuilder.m#L33

curl -H "Content-Type: application/json" -X POST "https://exp.host/--/api/v2/push/send" -d '{
  "to": "ExponentPushToken[XXXXXXXXXXXXXXXX]",
  "title":"hello",
  "body": "world",
  "_category":"@username/appName-basic",
}'
从“expo常量”导入常量;
从“世博会通知”导入*作为通知;
//设置类别
notificationcategoryasync(“基本”[

{identifier:“Yes”,buttonTitle:“Yes您真的很接近,experienceId和category用连字符“-”连接起来。查看iOS上的源代码,您可以看到格式字符串:


你真的很接近,experienceId和category用连字符“-”连接起来。查看iOS上的源代码,你可以看到格式字符串:


谢谢你,Dillon,在经历了几天痛苦的调试之后,这一切都很好,让我度过了一周。祝你新年快乐!这在android上似乎不起作用,你知道为什么吗?你的频道设置如何?我知道android需要额外的设置:
if(Platform.OS==“android”){notificationChannelAsync(“basic”),{name:“basic,重要性:Notifications.AndroidImportance.MAX,声音:“default”,振动模式:[0,250,500,250],});
我还没有在android上测试过它,但是看看java代码,它看起来可能与iOS不同:Expo还没有真正记录“category”api。所以我不确定
“\u category”
curl中的param是特定于iOS的,Android还需要其他东西吗?也许值得向Expo介绍如何使用类别,因为我在任何地方都找不到它的文档。谢谢你,Dillon,这很有效,在经历了许多痛苦的调试之后,我的一周过得很愉快。祝你新年快乐!这似乎对Android没有任何作用想法为什么?你的频道设置如何?我知道android需要额外的设置:
if(Platform.OS==“android”){Notifications.setNotificationChannelAsync(“基本”),{name:“基本”,重要性:Notifications.AndroidImportance.MAX,声音:“默认”,振动模式:[0,250,500,250],})
我还没有在android上测试过它,但是看看java代码,它看起来可能与iOS不同:Expo还没有真正记录“category”api。所以我不确定
是否“category”
curl中的param是特定于iOS的,Android还需要其他东西?也许值得向Expo介绍如何使用类别,因为我在任何地方都找不到它的文档。