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. Thanks for all your past and future contributions.

Archived:CellIds and songs in PySymbian

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
Tested with
Devices(s): N70, N95, N96
Platform(s): S60
Keywords: cellid, gsm ,audio
Created: gaba88 (29 Jul 2008)
Last edited: hamishwillee (31 May 2013)



This is a small code snippet that exhibits how powerful the location module is. Location-based applications are very attractive and very powerful. So this article presents an example that shows you how to play a song repeatedly when the cell id changes. Using songs is just an example of what could be done automatically when the current cell id changes.


Note: The location module requires capabilities ReadDeviceData, ReadUserData and Location starting with S60 3rd Edition.

Code Snippet

import location
import appuifw
import e32
import audio
class LocationInformerApp:
def __init__(self):
self.exitflag = 0 = u'Wiki Code'
def set_exit(self): = self.old_app_body
def run(self):
print u'*** Location Log ***'
prevLoc = u''
while not self.exitflag:
if prevLoc <> location.gsm_location():
print location.gsm_location()[3]
p ="c:\\test.mp3") #open the soundfile to play # play the sound file for three times this is optional
prevLoc = location.gsm_location()


  • Initially, when the application starts it plays a song, and when the cellid changes the applications plays the song again right from the beginning.
  • The code can be easily modified such that the device plays different songs in different region that have different cellid.


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