Las Batallas en el Desierto

Voy a guardar intacto el recuerdo de este instante porque todo lo que existe ahora mismo nunca volverá a ser igual.

I am going to keep my memory of this moment intact because everything that now exists will never be the same again.

This book was a required read for me when I was in high school and I’ve just read it again. It was good to remember those old days and reconnect with the main character of this story, a young Mexican boy who is dealing with an impossible love and the absurdity of the ruled by adults world that surrounds him.

And, here’s a great song based on this book from one of my favorite bands.

 

Android Services with Kotlin

An Android Service, is an application component that can perform long-running operations in the background, and it doesn’t provide a user interface.

A few example uses for a service could be:

  • Network transactions
  • Play music
  • Perform file I/O operations
  • Interact with content providers
  • Background operations

I’ve recently implemented a service in one of my applications to start a sound triggered by a BroadcastReceiver when an alarm expires and here is how I implemented it with Kotlin.

AlarmService.kt

Then, this is how it’s started from the BroadcastReceiver.

TimerExpiredReceiver.kt

Finally don’t forget to add your reference to your app’s manifest file.

By using this service I’m able to stop it from anywhere within the application and stop the alarm sound when the user interacts with my app by calling stopService().

I implemented this functionality in PowerNap, an app that will help you take efficient naps by controlling the time you sleep. You can find the source code in GitHub.

Posted in Dev