1, first take Cantk-runtime-demos to Local:
clone https://github.com/drawapp8/cantk-runtime-demos
2. Create an Android App (or copy an existing project):
cd cantk-runtime-demos-n-k com.-a-p./MyApp -t cd MyApp
3, merge PhoneGap and cantk-runtime related files.
GAMERUNNER=../GameRunner/platforms/androidmkdir$GAMERUNNER$GAMERUNNER$GAMERUNNER$GAMERUNNER$GAMERUNNER/CordovaLib/src/* src/.rm -rf assets/www/cordova-js-src/
4, modify Androidmanifest.xml, add activity
<activity android:name="com.tangide.GameRunnerActivity" android:label="@string/app_name"></activity>
5, Start 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);
(Please put the game in SDcard, the path is the same as the URL specified above, there is a test game in embeddemo/examples/)
6, compiling and installing
debugadb install -r bin/MyApp-debug.apk
If compiling however, please modify Project.Properties:
target=android-21
Example: Https://github.com/drawapp8/cantk-runtime-demos/tree/master/EmbedDemo
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Embed the CANTK runtime in an existing app