Introduction: Android Native Language Speaking Clock
My eyesight is not very good, It is the reason I wrote this script, I am not a programmer, I just want an application that can help me determine the right time, especially when I woke up in the middle of the night, of course I want to know what time it is. Very difficult if I had to look for glasses, then turn on the light only to look at the clock, while the Android smartphone can be reached without having to get out of bed.
The first thought is a watch that speaks, because with the ability from Google Text-to-speech, of course is easier and more pleasant to hear the designated time using language commonly used in everyday life.
Step 1: Change Your Google Text-to-speech Language
So the first step is to choose the language to be used, then install voice data, I use the Bahasa Indonesia, you can choose any language as you like.
Step 2: Install Python
Download and install Python to your PC, from https://www.python.org/downloads/release/python-2710/ , i prefer version 2.7.10. Let's we try a bit of Python, it's just an easy script :
In Python Shell type like this :
- import time (enter)
- clock = time.strftime("%I:%M") (enter)
- print clock (enter)
- result is current time, only hour and minute (that's all we want)
If there is no error then you're succesfull installing Python in your PC, we're not compile the script into an APK, we just test the script. Now we need to save that script.
in Python Shell type like this, create a new file (Ctrl+N), type as follow :
clock = time.strftime("%I:%M")
and save it as you like, and you can run it, to see the result. For full documentaion about strftime you can read it at
Step 3: Adding SL4A to Your Android
Yes, we use SL4A for interprete our script, you can download it from https://github.com/kuri65536/sl4a/releases/download/6.1.1/sl4a-r6.1.1-arm-debug.apk , now you can copy your previous script to your android, you can use Dropbox or PCSync from File Manager, save to your desire places (the place may vary, depends where you're install SL4A app.).
Open your script and adding few line; modify line 1 and 6, add lines 2, 3, 4, and 7 as follow :
- import time, random, android
- droid = android.Android()
- greet = ['Hello ','Hi ','Hola '] # or anything you desire, with your own language.
- G = random.choice(greet) # this G variable will get random greet, add more variation is great!
- clock = time.strftime('%I:%M')
- print G+clock # you can remove this line if you like
and then save and run, you can remove line 6 if you like or add # in the begining of the line 6.
Now you can create a shortcut from your script to the main screen, or you can create a shortcut on the Lock Screen (for systems that support).
Step 4: Make Icon Bigger
You can using Dekstop VisualiseRto make bigger custom icon, if you prefer my icon file you can download and use it.
I know this simple script is far from perfect, you can develop this script to becomes more perfect and much better, by studying SL4A and Python further, you can create a script that tells you about the status of the batteries, show your location or perhaps make a personal assistant, or whatever it is.