domingo, 23 de febrero de 2014

Primera versión de MyFartlek en Google Play ¡A correr!

La primera versión de MyFartlek ya esta disponible en Google Play para teléfonos con Android 4.0 o superior.

Con esta app puedes entrenar tus fartleks sin preocuparte de mirar continuamente el crono ni de llevar la cuenta de la ronda en la que estás. Tu teléfono te avisará al inicio de cada fase de la duración de esta y el ritmo que debes llevar.  Además, podrás crear todos los fartleks que quieras y después elegir cuál hacer.

Hace un par de meses empecé a interesarme por los fartleks. Cuando salía a correr de esta manera, tenía que tener en la cabeza toda la sesión y además descubrí que miraba constantemente el crono para ver si me tocaba cambiar el ritmo.

Así fue como decidí hacer una app que me alertara cuando tocase un cambio de ritmo y, de paso, me permitiera despreocuparme de tener todo el plan memorizado.

  • Creación y edición de Fartleks y sus respectivas fases
  • Avisos por voz al inicio de cada fase del fartlek
  • Generación  automática del comando de voz a escuchar en función del tiempo de duración y ritmo a llevar en el fartlek
  • Disponible en inglés y español 
  • Fondos de pantalla a elegir para cada fartlek. Bueno esto no era indispensable para correr, pero queda chulo :)
MyFartlek es una app que he hecho para mi propio uso así que espero que os guste. 

Descargar MyFartlek 1.0.0

domingo, 16 de febrero de 2014

Are you a runner? Try MyFartlek!

I'm working on a QML app for runners. Some weeks ago I tried to train doing fartlek sessions and I realized I was continuously looking to my watch checking for the next period. So I decided to make an app featuring voice alerts to order when to change my pace.

Yesterday I uploaded a beta to Google Play and is available to test through the linked G+ group.

I hope somebody of you will like it.

Try MyFartlek 0.9.2 Beta

viernes, 7 de febrero de 2014

Calling Android's Text to Speech from QT 5.2. An example of QT Android Extras

I wrote this post (in Spanish) a couple of weeks ago as a reminder just in case I have to do something similar in the future. Sometimes I found QT documentation is not all good  I would desire and with Android Extras I had to spend quite a lot of time to solve some problems. What I wanted to do is to call Adroid's TexToSpeech class from  QT so I used QtAndroidExtras documentation as a reference, this example of notifications and this post of someone else trying to do the same.

At the beginning, it seemed enough to me, in fact, changing a little the notification example with some code from the QT forum should have been a good solution. But the guy on the forum did not have a working code, he asked for help and there was no response. On the other hand, the sample code in QT notification example calls a static method and I wanted to create a Java class that inherited TextToSpeech (something that in the end I did not get).

As I said before, these are a set of notes I want to keep regarding some problems I found and how I solved them. So, the format is something like a personal notes, a FAQ or if you prefer, a conversation with myself.

1. I usually write code in QT but I have no experience as Android programmer.
Well, there is no solution for this. The only thing is to google searching for examples. Anyway, I wrote the resources I used at the beginning of this post.

2. After studying the examples, I see it is required to have access to the activity context so, it is necessary to create an object from a class with an activity context parameter in his constructor.
Your new class should extend QtActivity, it will provide the proper context when you invoke TextToSpeech class.

3. But it is required to implement onListener in my class and it is already inheriting QtActivity!
No problem, you can do both things at the same time:

public class TestAndroidClient extends QtActivity implements TextToSpeech.OnInitListener

4. I've created my class but I don't know the correct location in the file tree, moreover it isn't included in the apk when the project is build.
See the notification example and make a similar structure. At your project's root folder create a directory called android-source and a src one within it. From the last one you should have the rest of the structure for your java files, i.e.  org/qtproject/example/your-app-name/

Be sure to have these two lines in your project's .pro:


Check the build directory (normally named build-xxxx) for your class file. In linux you can use find:

find . -name

5. When I launch the application it crashes and closes without showing any exception report and the error is previous to my class invocation.
Maybe this is because the class is not found. Check your manifest.xml and look your activity tag, it should point to your class


6. But I want to write a class that inherits TextToSpeech so everything would be more object oriented.
Well... I don't have a solution for this. To tell the truth I failed to do a non static method, furthermore I haven't found an example doing that.

7. I'm trying a call my static method from the C++ code and nothing happens.
Take a look to your parameters signature. It is also important to use the right javaobject from C++to being recognised by the Java function. Having the following Java function:

    public static void test(String msg)
        System.out.println(msg );
        tts.speak(msg, TextToSpeech.QUEUE_FLUSH, null);


The appropriate C++ call will be:

    QAndroidJniObject javaMessage = QAndroidJniObject::fromString(msg);

8. I need a example!!
Ok, you can grab the source code from GitHub