CodePush 管理工具 App Center Cli 的常用命令行

App Center Cli 对React Native的使用

安装

在系统根目录下运行:npm install -g appcenter-cli

登录

  1. 登录
    appcenter login 运行之后会自动打开获取token的网页,复制粘贴到命令行即可。
  2. 查看注册信息
    appcenter profile list

创建应用

  1. 创建app
    appcenter apps create -d <appDisplayName> -o <operatingSystem> -p <platform>
appcenter apps create -d MyApp-Android -o Android -p React-Native
appcenter apps create -d MyApp-iOS -o iOS -p Cordova
  1. 查看创建的app列表
    appcenter apps list
  2. 设置当前应用
    appcenter apps set-current <appName>。作用:简化命令,之后的请求可以省略到 -a <appName>。
  3. 查询当前应用
    appcenter apps get-current
  4. 创建环境
  • 测试环境
    appcenter codepush deployment add -a <ownerName>/<appName> Staging
  • 生产环境
    appcenter codepush deployment add -a <ownerName>/<appName> Production
简化写法:
appcenter codepush deployment add Staging
appcenter codepush deployment add Production

以下命令均为简化后

  1. 查看app下所有环境的key
    appcenter codepush deployment list --displayKeys

上传bundle

appcenter codepush release -a <appName> -c <updateContentsPath> -t <targetBinaryVersion> -d <deploymentName>

appcenter codepush release  -c ./bundle -t 0.0.1 -d Staging
[-t|--target-binary-version <version>]
[-с|--update-contents-path <updateContentsPath>]
[-r|--rollout <rolloutPercentage>]
[--disable-duplicate-release-error]
[-k|--private-key-path <privateKeyPath>]
[-m|--mandatory]
[-x|--disabled]
[--description <description>]
[-d|--deployment-name <deploymentName>]
[-a|--app <ownerName>/<appName>]
[--disable-telemetry]
[-v|--version]

查看热更新历史记录

appcenter codepush deployment history <deploymentName>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 APP center 中配置 React Native Pushcode,需要按照以下步骤进操作: 1. 在 APP center 中创建一个新项目,并将其与你的 GitHub 或 Bitbucket 仓库关联。 2. 在你的 React Native 项目中安装 App Center Push SDK。可以使用以下命令: ``` npm install appcenter-push --save ``` 3. 在项目中添加以下代码,以初始化 App Center Push SDK: ```javascript import AppCenterPush from 'appcenter-push'; componentDidMount() { AppCenterPush.setListener({ onPushNotificationReceived: function (pushNotification) { console.log('Push notification received:' + pushNotification.message); } }); AppCenterPush.getInitialNotification().then(notification => { console.log('Initial notification:' + notification); }); } ``` 4. 在 App Center 中创建推送通知。可以通过以下步骤完成: - 在 App Center 中单击“推送”选项卡。 - 点击“新建”按钮。 - 输入通知的标题和正文。 - 选择要接收通知的应用程序。 - 选择要接收通知的设备。 - 点击“发送”按钮。 5. 在应用中测试推送通知。可以使用以下命令向应用发送推送通知: ``` curl -X POST \ -H "Content-Type: application/json" \ -H "X-API-Token: YOUR_API_TOKEN" \ -d '{ "notification_content": { "name": "test notification", "title": "test notification title", "body": "test notification body" }, "notification_target": { "type": "devices_target", "devices": ["YOUR_DEVICE_ID"] } }' \ https://api.appcenter.ms/v0.1/apps/YOUR_ORGANIZATION/YOUR_APP/push/notifications ``` 这将向设备发送一条测试通知。在应用中接收到通知后,可以在控制台中查看通知的日志信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值