热更新 codepush
- Code Push 热更新使用详细说明和教程
- React-Native 使用微软的CodePush进行热更新,继续填坑
- react-native-android实战:4 CodePush使用
- React Native 使用Code-Push 更新APP
步骤
-
npm install -g code-push-cli
安装 cli.
code-push -v
查看版本信息:1.12.6-beta
-
code-push register
在浏览器打开的页面选择认证方式,认证成功后跳转到 access key 页面(图一)。
复制 key 在命令行执行,注册成功返回信息
Successfully logged-in. Your session file was written to C:\Users\BinG\AppData\Local.code-push.config. You can run the code-push logout command at any time to delete this file and terminate your session.
-
code-push app add <appName>
注册 app 获取 key
Successfully added the "zyxldsapp" app, along with the following default deployments:
┌────────────┬───────────────────────────────────────┐
│ Name │ Deployment Key │
├────────────┼───────────────────────────────────────┤
│ Production ││
├────────────┼───────────────────────────────────────┤
│ Staging │ │
└────────────┴───────────────────────────────────────┘
-
npm install --save react-native-code-push
安装 React Native module for CodePush -
react-native link react-native-code-push
图二
rnpm link the plugin. -
修改 MainActivity.java 文件
new CodePush("deployment-key-here" , this , BuildCofig.DEBUG)
deployment-key-here 可以通过 code-push deployment ls zyxldsapp -k
命令查看
Staging 为测试阶段,Production 为生产环境
当应用开发完成,可使用 code-push promote
命令从 Staging 迁移到 Production.
-
code-push release-react <appName> <platform>
CLI docs 发布更新
mandatory
-m 强制更新 -
updateDialog
options
optionalIgnoreButtonLabel
Defaults to "Ignore"
optionalInstallButtonLabel
Defaults to "Install"
optionalUpdateMessage
Defaults to "An update is available. Would you like to install it?"
title
Defaults to"Update available" -
图例


网友评论