[Other SmartWatches] marciallus:
Hello

I've recently buy a Toq Qualcomm SamrtWatch and, because the sdk does not permit a lot of things, I've started a little hacking

In this thread I would like to explain how i've beenableto create a custom watch face. This is a first try, I'll hope I will come later to explain more things.

And sorry for my english, I'm french. Ok let's start :

- First get the Toq Manager Android application because it contain some watch, if you own a Toq you must have install it via google play store. :

you can follow the tuto here http://xdaforums.com/showthread.php?t=1755436 but it must be :

adb pull /data/app/com.qualcomm.toq-1.apk

- 2 extract the apk to find where the watch face are :

for this I will android-apktools, https://code.google.com/p/android-apktool.

SO basically in my folder I have :

apktool
apktool.jar
com.qualcomm.toq-1.apk

I extract the apk in a new directory, named "toq" with:

./apktool d com.qualcomm.toq-1.apk toq

- 3 find the watch face :

in the toq/Assets directory there is a file named "allclocks.json" wich contains the watch faces definitions :

{
"Clocks": [
[...]
{
"bundle": "degreesclock.zip",
"type": "dynamic"
},
{
"displayName": "Agenda",
"icon": "clock_agenda",
"type": "builtin"
}
]
}

so you can add a custom watch face by modifying this json and adding this lines for example

{
"bundle": "myclock.zip",
"type": "dynamic"
},

you can see that a "dynamic" watch face is defined by a zip file, wich is the assets folder too. you must add this zip file to create the watch

4: Create the watch face :

There is two zip file to create to add a custom watch face. the first will describe the watch face. It will be named xxxxx_app.zip, xxx is your watch face name, mycolock for example.

This zip file will contains two lua file :

- manifest.lua will describe the watch :

clock {
name = "MyClock",
entrypoints = "ClockEntries"
}

the second will be executed by the Toq to draw the watch face and will be named init.lua.

We can add image file that will be used by the init.lua script.

I started a project on github to convert png to qualcomm img format : https://github.com/marciallus/toq_imgTools

I attach the myclock_app.zip in this thread.

The second zip file will be name xxxxx.zip, myclock.zip for example. and will contain 3 files:

- The zip files create before will be add to in this zip, I dont see why.

- clock.json will describe the watch too

{
"Clock": [
{
"displayName": "My Clock",
"packageName": "com.qualcomm.qce.myclock",
"asset": "myclock_app.zip",
"icon": "my_clock.png",
"jsonName":"com.qualcomm.qce.myclock/MyClock"
}
]
}

- my_clock.png will be displayed in the Taq Manager Android Application to choose the custom watch

I've attached the myclock.zip in this thread too

5 : Repackaging

Now we have created the two needed files in assets folder we will recreate the apk to resintall this modified version on the phone :

-first use apktool to repackaging in com.qualcom.toq-modified.apk

./apktool b toq com.qualcom.toq-modified.apk

-we need to sign the apk :

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore [your keystore] com.qualcom.toq-modified.apk [your key]

you can see how to create a keystore here : http://developer.android.com/tools/publishing/app-signing.html

- we can zip align the file, it's better :

zipalign -fv 4 com.qualcom.toq-modified.apk com.qualcom.toq-modified-aligned.apk

6 : Installing

We just have now to reinstall the modified apk :

adb install -r com.qualcom.toq-modified-aligned.apk

And if you go on your phone on Toq Manager -> Preferences -> Clock Style !! TADA !! your clock is here, you can select it to push it to your watch !!

that's all

feel free to comment, it's my first thread creation so I'm open for remarks :)

--

MarCo