How to compile for android?

Hello everyone.
Can somebody please explain how the compiling for android works.
Whenever I compile, two new files appear.
One of them is the AP K, and the other one I have no idea what to do with it.
And besides, I tried a script and it ran perfectly in the PC, but when I compiled it for android, and installed the APK file and ran it, I got a black screen with no sound and nothing to interact with, well, except for the screen reader repeating the number 0 for some reason whenever I swipe left or right. I tried it on another phone and it didn't even run, it kept crashing.
Can somebody please explain the what to do and what not to do if wanting to compile for android.
Does it differ from a phone to another?
Are there some parameters I have to take care of before compiling?
The only script I seem to get a success when running, is when it's a simple alert box.

I wish somebody could point me in the right direction, because I know I am missing something here.
Thank you so much.

You're compiling correctly. However, all screen readers will need to be turned off, and you must define your touch gestures yourself.

Hello.
Thank you for the help, but what do you mean exactly, how do I do that?
I should also note that I tried running the script from inside the NVGt android app, and I got the same result.
I tested it with this script by the way, which was written inside the touch interface reference:

#include"touch.nvgt"
#include"speech.nvgt"
touch_gesture_manager touch;
void main() {
show_window("touch screen test");
//attach multiple keys to a single gesture.
int t = {KEY_TAB, KEY_LSHIFT};
touch_keyboard_interface testsim(touch, {{"swipe_left1f", KEY_LEFT}, {"swipe_right1f", KEY_RIGHT}, {"swipe_up1f", KEY_UP}, {"swipe_down1f", KEY_DOWN}, {"double_tap1f", KEY_RETURN}, {"tripple_tap1f", t}, {"swipe_left2f", KEY_ESCAPE}, {"swipe_right2f", KEY_Q}, {"double_tap2f", KEY_SPACE}});
touch.add_touch_interface(testsim);
dictionary@d = {{"double_tap1f", KEY_X}, {"double_tap2f", KEY_Z}};
// Demonstrate registering an interface for only a portion of the screen.
touch.add_touch_interface(touch_keyboard_interface(touch, d, 0.5, 1.0, 0.5, 1.0));
while (!key_pressed(KEY_ESCAPE) and !key_pressed(KEY_AC_BACK)) {
wait(5);
touch.monitor();
if (key_pressed(KEY_LEFT)) speak("left");
if (key_pressed(KEY_RIGHT)) speak("right");
if (key_pressed(KEY_DOWN)) speak("down");
if (key_pressed(KEY_UP)) speak("up");
if (key_pressed(KEY_TAB)) {
speak("tripple tap");
if (key_down(KEY_LSHIFT) or key_down(KEY_RSHIFT)) speak("you are holding down shift", false);
}
if (key_pressed(KEY_SPACE)) speak("double tap 2 fingers");
if (key_pressed(KEY_ESCAPE)) exit();
if (key_pressed(KEY_Q)) speak("swipe right 2 fingers");
if (key_pressed(KEY_RETURN)) speak("you just double tapped the screen!", false);
if (key_pressed(KEY_X)) speak("You just double tapped another part of the screen!");
if (key_pressed(KEY_Z)) speak("You just double tapped with 2 fingers on another part of the screen!");
}
}

Aren't scripts inside references flawless and with no mistakes?
I don't understand. I mean, shouldn't it work as intended?
In any case, could you show me how to identify the touch interface thing in a small example of a few lines, pretty please?
Thank you so much, really.

So, that's correct script. Turn your screen reader off after running the APK file, and try the swipes.

For some reason the screen reader speak method doesn't work on some devices, try tts_voice object in this case.

1 Like

thank you so much.
that was exactly what i was facing, when i switched to the tts voice object it worked instantly no problems.
There is another thing I found. I put a small sound file iin the script to see if everything is working correctly, and I played it in the background using the sound pool.
So it was the same script running with some music in the background as I test those buttons.
It was all okay when I ran it in the PC, but when I did in the android after compiling it, there was no music playing.
So my question here is:
are the sound files included in the APK file after the compiling is done? Or do I need to add them into some location inside the android device? Or is it an entirely different story of how to do it.
Thank you so much again for your time.

Hi,

Yes, you need to put your music in a pack file and then embed the pack file into your app. Later this will become more transparent, but for now the #pragma embed "mypack.dat" is the only method by which to embed sounds into an Android app until the next release. You load the pack by creating a pack object then executing the line my_pack_file.open("*", PACK_OPEN_MODE_READ); and setting the sound_default_pack property to the pack you've just opened.