Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to develop a Geo-scheduler application - Part 3

From Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Created: croozeus (31 Jul 2008)
Last edited: hamishwillee (31 May 2013)



Finally we have the last article in the series of "How to develop a Geo-Scheduler or a Location Based Scheduler application" The first two articles can be found here- Part 1 and Part 2. If you have followed this series of articles, then after finishing this one, you should be capable enough to create your own location based application.

In this article - Part 3, we would learn about the Application operations (functions) of the Geo-scheduler application. The application operations consists of functions responsible for the UI of the Geo-scheduler. It contains functions which generate menus, selection lists,etc.

Application operations are listed below:

  • ms_handler() : The main screen handler
  • main() : The first and the main screen
  • help() : method for using the help screen
  • tracker() : The main tracker function
  • background_handler() : Provided Background handling options
  • Calling the methods : Sequence in which we call the defined methods.

As the functions are responsible for UI and generating menus, selection lists, they could be modified according to the requirements of the developer.

Lets discuss the above in detail.

Part 3


ms_handler is a short for main screen handler. Using this method - we create a custom menu and a UI. The ms_lb.current() is used to trigger or direct to a specific method.

index= ms_lb.current()

For example if index = 0 then the method to add a new reminder is called - add_reminder()

Thus the code of ms_handler() could be as follows:

# MS option handler.
def ms_handler():
index = ms_lb.current()
if index == 0:
if index == 1:
# Show menu.
editreminder_opts = [u"Location", u"Reminder description"]
search_by = appuifw.popup_menu(editreminder_opts, u"Search by:")
if search_by == 0:
# Edit reminder by location.
if search_by == 1:
# Edit reminder by reminder.
if index == 2:
if index == 3:


This would be the first method to be called on the launch of the application. Its responsibility is to set to ms_lb.

where the below is true:

ms_opts = [u"Add Reminder", u"Edit Reminder", u"Add Location", u"Edit Location"]
ms_lb = appuifw.Listbox(ms_opts, ms_handler)

The function can be modified for better enhancement of the UI (may be a startup image on the canvas)

The function also generates a main menu for the application, including options like Help and Start Tracker.

The code for the main() could be as follows:

def main(): = ms_lb = quit
# Set application initial menu. = [(u"Help", help),(u"Start Tracker", background_handler)]


As the name suggests this function provides information and instructions to the user of the application.

The code for the help() function could be as follows:

# Help screen.
def help():
helptext = appuifw.Text()
helptext.set(u"Scheduler:\nHere you can manage the locations and the reminders associated with those locations.") = helptext = main

The help text can be more descriptive and instructions may be added to the sample statement.

Also a text file containing the instructions for using the application could be opened through this functions.


This is the main tracker function, however only background_handler() is called from the menu in the main function.

We use the tracker to assign the current cellid to variable curr_cellid or the last cellid variable, last_cellid.

The appswitch module is used in this function. We can use it to trigger the application to foreground and background as follows:


The appswitch extension could be downloaded here.

The code for the tracker() could be as follows:

# The main tracker function.
def tracker():
(mcc, mnc, lac, cellid) = location.gsm_location()
while track == 1:
(mcc, mnc, lac, cellid) = location.gsm_location()
curr_cellid = cellid
if not curr_cellid == last_cellid:
reminderscnt = len(reminders)
tracker_log = ""
curr_date = time.strftime("%d/%m/%Y")
for i in range(reminderscnt):
j = str(i)
reminder_date = time.strftime("%d/%m/%Y", time.gmtime(float(reminders[j]['date']) + 5400))
if str(reminders[j]['cell']) == str(curr_cellid) and curr_date == reminder_date:
tracker_log += j + ": (" + str(curr_cellid) + ") " + str(reminders[j]['desc']) + "\n"
appuifw.query(unicode(str(reminders[j]['desc'])), "query")
last_cellid = curr_cellid

Here we use e32.ao_sleep(5) so that the function repeats, (if recursive ) every 5 seconds. The time can be adjusted according to the needs of the developer.

Other option is the timers, instead for sleep function.

The sample code for timers could be found here. sleep is used here to avoid complexity.


The background_handler() is called from the main menu when "Start Tracking" is selected.

A menu including "Stop Tracker" and "Help" is created using function.

appswitch is used to set the application is background using switch_to_background(app_name) method. The appswitch extension could be downloaded here.

The code for background_handler() could be as follows.

def background_handler():
global track
if not track or track == 0:
track = 1 = [(u"Help", help),
(u"Stop Tracker", background_handler)]
elif track == 1:
track = 0

Calling the methods

The defined methods need to be called in a proper sequence, and some variables need to be populated.

The file handler for alarm or alert could be set as:

file_handler_alert = "Path to the sound file"

The sound file should be .wav, .mp3, .acc (supported to be played by the specific Mobile device)

Sequence of initializing and calling methods:

# Populate cellids and geo dictionary and loclist list.
cellids = {}
geo = {}
track = 0
# Populate reminder and remsdesc dictionary.
reminders = {}
remindersdesc = {}
# temporary cell id list for testing without network requirement.
cellidlist = [1563, 1671, 1523, 1111, 1111, 1671]
S =
# Start program.
app_lock = e32.Ao_lock() = u'Geo-Sheduler'



Screenshot0016.jpg Screenshot0017.jpg Screenshot0018.jpg

Screenshot0019.jpg Screenshot0020.jpg Screenshot0021.jpg

Screenshot0022.jpg Screenshot0023x.jpg Screenshot0024x.jpg



We have concluded the series of the articles on "How do develop a Geo-scheduler application"

If you have been following the series, you may now be able to make location based application - logic, design and UI - Using the template from the geo-scheduler application

The links to the previous articles in the series could be found below.

Go to

This page was last modified on 31 May 2013, at 01:03.
59 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.