Home » Posts tagged "cordova"

微軟的 CodePush

看到微軟推出的 CodePush,針對 CordovaReact Native 類透過 WebView 跑的程式提出的方案。原因是 Apple 的 App Store 審核都要很久,透過 CodePush 可以直接更新程式:

CodePush is a cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices. It works by acting as a central repository that developers can publish certain updates to (e.g. JS, HTML, CSS and image changes), and that apps can query for updates from (using our provided client SDKs). This allows you to have a more deterministic and direct engagement model with your end-users, while addressing bugs and/or adding small features that don’t require you to re-build a binary and/or re-distribute it through any public app stores.

FAQ 文件裡提到了這點:(Frequently Asked Questions · CodePush)

Does the Apple App Store allow developers to perform these types of updates?

According to section 3.3.2 of Apple’s developer agreement, as long as you are using the CodePush service to release bug fixes and improvements/features that maintain the app’s original/presented purpose (i.e. don’t CodePush a calculator into a first-person shooter), then you will be fine, and your users will be happy. In order to provide a tangible example, our team published a (pretty cheesy!) CodePush-ified game to the Google Play Store and Apple App Store, and had no problems getting it through the review process.

Because Cordova apps are executed within a WebView, and React Native apps are executed within JavaScriptCore, from a technology perspective, these runtimes are unique in their ability to leverage dynamic code downloads according to the aforementioned Apple developer agreement.

同樣的想法如果真的可行,應該會有其他更開放的 open source 方案可以用 (而非綁定性的服務,而是可以掛到自己的 CDN 上下載更新),先觀察一陣子...

Ubuntu 下建立 Cordova 的 Android 環境...

依照「Cordova: Getting Started with iOS and Android Applications (Tech Tip #14)」這篇的方法,再加上一些以前練出來的經驗,把系統給弄起來了。

首先是先到 Android 官網下載 Android SDK,目前版本是 adt-bundle-linux-x86_64-20131030,找個合適的地方解開後 (我是放到 $HOME/android 下),把 PATH 加進去:

export PATH="${HOME}/android/sdk/platform-tools:${HOME}/android/sdk/tools:${PATH}"

接下來是透過 nvm 安裝 node.js,先安裝 nvm:

wget https://raw.github.com/creationix/nvm/master/install.sh
sh install.sh

然後重新啟動 shell 讓 nvm 與 PATH 生效後,安裝 0.10.26 (目前的最新版),並且預設用這個版本:

nvm install 0.10.26
nvm alias default 0.10.26

接下來一樣是重新啟動 shell,就可以裝 Cordova 了:

npm install cordova

後面就可以照抄原始範例:

cordova create hello org.samples.wildfly.cordova.hello HelloWorld
cd hello
cordova platform add android
android create avd --name myCordova --target 1
cordova emulate android

然後 AVD 是有名的慢,請耐心等候... XD

跑出來長這樣:

Archives