@appwin/ react-native (英语)
对本地的Appwin SDK进行反应 社区供养和 信使是本地化的( SwiftUI on iOS, Compose on Android); 此 层带有身份、会话和切入点.
全向导,每产品API和仪表板设置: https://appwin.io/docs/sdk/安装
安装
npm install @appwin/react-native
cd ios && pod install
然后重建:本土模块只存在于再编译的二进制中.
要求:回放原生0.75或后回放,iOS 16.0,Android API 24 (中文(简体) )minSdk 24) (中文(简体) ).
在 iOS 上, 大桥从 Swift 软件包管理器取取本地的 SDK
(单位:千美元)https://github.com/appwin-dev/appwin-ios(通过React Industrial's
spm_dependency而不是从可可Pods树干: pod install 将软件包添加到
pods 工程, 除了模板外, 您的 Podfile 中没有什么可添加的
react_native_post_install。它的“静态链接,这可能导致链接器
错误 \ 警告是预期的, 对这个包无害 。 删除任何
pod 'AppwinCore' (或其他) Appwin… 从您的 Podfile: 两份副本
会碰撞.
博览会:博览会 去装入没有第三方本地模块,所以使用 发展
(单位:千美元)npx expo run:ios 编号 : npx expo run:android,或EAS). 货船没有
配置插件: iOS AppDelegate 和下面的 Android 列表变化
进入本地项目 npx expo prebuild 生成.
产品
AppwinCore 每一产品都带有特性和会话;其他产品为:
选入.
| 产品 | 展览 | 文档 |
|---|---|---|
AppwinCore | 配置,身份,事件,同意,推令牌,可用. 要求. | 双核 |
AppwinSupport | 信使 (嵌入式视图或模式). | 支助 |
AppwinCommunity | Feed(嵌入式视图或模式), profile,未读取计数,成员事件. | 社区 |
AppwinNotifications | 按下, 内接消息( P)AppwinPush 沿着水龙头走. | 通知 |
AppwinAnalytics | 会话,屏幕,崩溃,会话重放. | 分析 |
AppwinAttribution | 收购归属,广告同意. | 归属 |
快速启动
import { AppwinCore, AppwinSupport } from '@appwin/react-native'
await AppwinCore.configure({ projectAppId: 'your-app-id' })
const support = await AppwinSupport.initialize()
if (support.status === 'ready') {
await AppwinSupport.presentMessenger()
}
configure 覆盖每个启用的产品:它们分享由
柯尔. initialize() 询问服务器是否可以为此应用程序打开产品
解决而不是拒绝(ready | unavailable | notConfigured |
unknown),所以在答案上打开自己的入口。 设定前识别
(a) 社区概况,否则以匿名概况为依据:
await AppwinCore.identify(user.id, { email: user.email, name: user.name })
await AppwinCore.updateUser({ plan: 'pro' })
await AppwinCommunity.setUser({ nickname: user.nickname })
await AppwinCore.logout()
identify 财务报告和审定财务报表 updateUser 拒绝失败。 其它的电话都会降低到
取而代之的是中性值(只有空白) projectAppId 或掷出任何物来
需要没有 try编号 :catch。事件经过
核心,无论产品:
await AppwinCore.track('purchase', { value: 9.99, currency: 'EUR' })
屏幕可以嵌入或以模式显示:
import { AppwinCommunity, AppwinCommunityView } from '@appwin/react-native'
<AppwinCommunityView style={{ flex: 1 }} /> // embedded, no close button
await AppwinCommunity.presentCommunity() // modal
见 快速启动。 。 。 .
推 (拥有它的堆栈)
SDK线路在Appwin上为您出手(包括冷启动). 打电话
AppwinNotifications.start() 启动时, 之后 configure。在iOS上,添加一个
线条到您的 Swift AppDelegate 所以发射水龙头不会被错过
JavaScript 运行 :
import AppwinNotifications
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
AppwinNotifications.ensurePushNotificationDelegate()
// ... React Native setup
}
在Android上,推走火地:加上你 google-services.json,则
com.google.gms.google-services 拖曳插件和
com.google.firebase:firebase-messaging 到您的应用程序( SDK 编译针对
火炉发射,但不会带来.
如果您的应用程序拥有它的 push 堆栈( Firebase Messageing) , 则转发每个回调到
AppwinPush 并只当电话决定时自己处理信件
false数字 :
import messaging from '@react-native-firebase/messaging'
import { AppwinNotifications, AppwinPush } from '@appwin/react-native'
// index.js, outside any component: runs headless on Android.
messaging().setBackgroundMessageHandler(async (message) => {
await AppwinPush.handleMessage(message.data ?? {})
})
// At startup, after AppwinCore.configure().
await AppwinNotifications.start(true, { installsNotificationDelegate: false })
const initial = await messaging().getInitialNotification()
if (initial) await AppwinPush.handleTap(initial.data ?? {})
messaging().onNotificationOpenedApp((message) => {
void AppwinPush.handleTap(message.data ?? {})
})
messaging().onMessage(async (message) => {
const data = message.data ?? {}
if (await AppwinPush.handleMessage(data)) return
if (await AppwinPush.handleForeground(data, message.notification)) return
// not Appwin's, or Appwin let you show it
})
在Android上,去掉SDK的短信服务,让Firebase给你的,
以
messaging().onTokenRefresh((token) => AppwinCore.registerPushToken(token, 'android'))数字 :
<!-- android/app/src/main/AndroidManifest.xml, with xmlns:tools declared -->
<service
android:name="io.appwin.notifications.AppwinFirebaseMessagingService"
tools:node="remove" />
崩溃
AppwinAnalytics.initialize() 也捕捉本地坠机和未被发现
JavaScript错误及其堆栈,在下一次发射时发送. 处理器已经
已安装( 哨兵, Crashlytics, 红色盒子) 继续运行: Appwin 链条 .
await AppwinAnalytics.initialize() // crash reporting on
await AppwinAnalytics.initialize({ crashReporting: false }) // opt out
try {
await checkout()
} catch (error) {
AppwinAnalytics.recordError(error) // non-fatal issue
}
赫尔墨斯的无手承诺被拒绝被俘虏,只释放 开发 React Industrial 保留它们以示警告). 释放堆栈停留 在源图上传船只之前, 已修改 .
会话重放
在仪表盘上重新播放会话时, AppwinAnalytics.initialize()
将部分会话记录为视频,原生,每秒一个帧,下同
和事件一样 在编码之前, 面具发生在设备上 :
文本输入、文本和图像,除非项目设置另有说明.
import { AppwinMask, AppwinUnmask } from '@appwin/react-native'
await AppwinAnalytics.initialize({ sessionReplay: false }) // never record this app
<AppwinMask>
<Text>{user.iban}</Text> {/* hidden, whatever the settings */}
</AppwinMask>
<AppwinUnmask>
<Text>{product.title}</Text> {/* shown even when all text is masked */}
</AppwinUnmask>
都变成平地 View中文本输入 <AppwinUnmask> 保持面具.
新建筑
通过React Industrial 的模块和观点在两种架构上都起到实际作用
中间层。 这些观点是传统观点管理者:来自React Independent 0.74
相接层自行取出. 只在0.73上与新架构
启用, 列表 AppwinCommunityView, (中文(简体) ), AppwinSupportMessengerView, (中文(简体) ),
AppwinMaskView 财务报告和审定财务报表 AppwinUnmaskView 下级
unstable_reactLegacyComponentNames (计: ios 财务报告和审定财务报表 android在你的应用程序
react-native.config.js。 。 。 .
支助
Bugs and questions:这个寄存器的问题. 任何与你有关的东西 账户、计费或数据通过您的 Appwin 中的支持部件 仪表板.
许可证
专有,参见 自由主义。这一来源对于可审计性是公开的 和工作室侧调试, 不重复使用.