將cantk runtime嵌入到現有的APP中

來源:互聯網
上載者:User

標籤:cantk   html5   phonegap   

1,先取cantk-runtime-demos到本地:

git clone https://github.com/drawapp8/cantk-runtime-demos

2,建立一個Android App(或者拷貝現有的項目):

cd cantk-runtime-demosandroid create project -n MyApp -k com.demo -a MyAppActivity -p ./MyApp  -t cd MyApp

3,合并phonegap和cantk-runtime相關檔案。

GAMERUNNER=../GameRunner/platforms/androidmkdir -p assetscp -rvf $GAMERUNNER/libs .cp -rvf $GAMERUNNER/src/* src/.cp -arvf $GAMERUNNER/res/xml rescp -arvf $GAMERUNNER/assets/www assets/cp -rfv $GAMERUNNER/CordovaLib/src/* src/.rm -rf assets/www/cordova-js-src/

4,修改AndroidManifest.xml,增加activity

<activity android:name="com.tangide.GameRunnerActivity" android:label="@string/app_name"></activity>

5,啟動GameRunnerActivity

import com.tangide.GameRunnerActivity;...Intent intent = new Intent();Bundle bundle = new Bundle();  intent.setClass(EmbedDemoActivity.this, GameRunnerActivity.class);bundle.putString("url", "file:///mnt/sdcard-ext/cantk-rt-root/game1/index.html");intent.putExtras(bundle);startActivity(intent);

(請把遊戲放在SDCARD中,路徑與上面指定的URL一致, EmbedDemo/examples/裡有測試遊戲)

6,編譯安裝

ant debugadb install -r bin/MyApp-debug.apk

如果編譯不過,請修改project.properties:

target=android-21

樣本:https://github.com/drawapp8/cantk-runtime-demos/tree/master/EmbedDemo

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

將cantk runtime嵌入到現有的APP中

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.