在新的Expo SDK 43之后,IntentLauncherstartActivityAsync()
方法不接受字符串作为参数。现在,ActivityAction
类型是必需的。
如何创建自定义ActivityAction
?
Expo SDK 42:https://docs.expo.dev/versions/v42.0.0/sdk/intent-launcher/#intentlauncherstartactivityasyncactivityaction-意图图
Expo SDK 43:https://docs.expo.dev/versions/latest/sdk/intent-launcher/#intentlauncherstartactivityasyncactivityaction-params
要创建自定义活动,必须首先编辑此处描述的AndroidManifest
构建项目后,只需使用expo-intent启动器库中的startActivityAsync调用活动
startActivityAsync(_ACTIVITY_ACTION_, params)
.then((t) => {
console.log(t);
})
.catch((err) =>
console.error(
`err: ${JSON.stringify(
err.request
)}`
)
);