28 lines
2.1 KiB
Markdown
28 lines
2.1 KiB
Markdown
How does this basically work?
|
||
-----------------------------
|
||
|
||
At the moment, the Android App is a WebView which renders the normal web page. The IITC script is injected by calling ```iitc_view.loadIITC_JS(Context)```. The app uses a local version of the script, which is located in the assets folder, if no external source is given (see "pref\_iitc\_source").
|
||
|
||
Communication from app to script is handled by loading Javascript function calls. For example: ```iitc_view.loadUrl("javascript: window.goBack();");```
|
||
|
||
Communication from script to app is handled by the JavascriptInterface (see /mobile/src/com/cradle/iitc\_mobile/IITC_JSInterface.java). If a method ```foo(String)``` is defined in JSInterface, it can be called by ```android.foo("Hello World")``` in the IITC script.
|
||
|
||
Debugging
|
||
---------
|
||
|
||
If you want to debug the APK, I suggest [reading up on Google’s documentation](https://developer.android.com/index.html).
|
||
|
||
Debugging IITC(M) **after** it has booted is relatively easy: you can switch to the “debug” tab, which is a low end developer console. It renders all calls to `console.*`, so you can use it just like you expect. It may be easier to develop in a desktop browser. Set it up like explained [in the normal hacking guide](https://github.com/breunigs/ingress-intel-total-conversion/blob/gh-pages/HACKING.md), but fake your user agent or modify the detection in `code/smartphone.js` and `main.js`. The device ID is printed to the debug console on IITC boot.
|
||
|
||
Debugging IITC(M) **before** it has booted requires the Android Developer Tools. Connecting your device and running `adb logcat` should print the debug log to your computer until the low-end dev console mentioned above is available.
|
||
|
||
|
||
Building the APK
|
||
----------------
|
||
|
||
- **ant:**
|
||
Set the ANDROID_HOME environment variable:
|
||
```export ANDROID_HOME=/path/to/android_sdk```
|
||
Then build the app via the build.py script ```./build.py mobile```
|
||
- **Eclipse:** Just import this project and klick the build button. Ensure that you have iitc.js in your assets folder. This is automatically created, when executing ```./build.py mobile```. Otherwise, just copy the IITC script to the assets folder and rename it to iitc.js
|