Ok, I've checked my code on my phone now and you're right - it crashes.
It seems that e32.Ao_timer cannot be used across threads. This would be logical since AFAIK the Active Objects it is based on are thread specific (i.e. every thread has its own Active Objects pool).
But do you really need to use threads? Let's just stay with Active Objects. Here's an example (checked):
Code:
import e32
import appuifw
def timerfunc():
print 'check gps here'
timer.after(30, timerfunc)
timer = e32.Ao_timer()
timerfunc()
appuifw.app.menu = [(u'Stop', timer.cancel)]
lock = e32.Ao_lock()
appuifw.app.exit_key_handler = lock.signal
lock.wait()
The trick here is to use the timer. Since we're staying in lock.wait() most of the time, the timer will get called as expected (because both of them are based on Active Objects, hence the "Ao_" in their names). Every time the timer gets called, it does its job and resets itself to get called in the next 30 sec.
Any args for the timer could be passed as global variables. If you don't like it, here's another way:
Code:
def timerfunc(arg1, arg2):
print 'check gps here'
print 'args:', arg1, arg2
timer.after(30, lambda: timerfunc(arg1, arg2))
Note that because now we pass two args to timer.after(), it returns immediately (read PyS60 docs for more info).