SoFunction
Updated on 2025-03-11

Methods to embed cantk runtime into existing APP

1. First take cantk-runtime-demos to the local area:

git clone /drawapp8/cantk-runtime-demos

2. Create an Android App (or copy an existing project):

cd cantk-runtime-demos
android create project -n MyApp -k  -a MyAppActivity -p ./MyApp -t 
cd MyApp

3. Merge phonegap and cantk-runtime related files.

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

4. Modify and add activity

<activity android:name="" android:label="@string/app_name">
</activity>

5. Start GameRunnerActivity

import ;
...
Intent intent = new Intent();
Bundle bundle = new Bundle(); 
(, );
("url", "file:///mnt/sdcard-ext/cantk-rt-root/game1/");
(bundle);
startActivity(intent);

(Please put the game in SDCARD, the path is the same as the URL specified above, and there is a test game in EmbedDemo/examples/)

6. Compile and install

ant debug
adb install -r bin/

If it doesn't compile, please modify:

target=android-21

Example:/drawapp8/cantk-runtime-demos/tree/master/EmbedDemo

Summarize

The above is the entire content of this article. I hope that the content of this article has certain reference value for your study or work. Thank you for your support. If you want to know more about it, please see the following links