Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 23:47, 29 July 2008.

Cellids and Songs

From Forum Nokia Wiki

This is a small code snippet that shows how powerful is the location module. 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.

Initially, when the application starts it plays a song, and when the cell id changes the applications plays the song again right from the beginning.

Using songs is just an example of what could be done automatically when the current cell id changes.

Code

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

References

Related Discussions
Thread Thread Starter Forum Replies Last Post
Tones implemetation on NOKIA 3650 s01200994 Mobile Java General 2 2003-11-27 08:43
3595/3590 not document referenced? digbyn@yahoo.com Audio 4 2003-11-30 02:01
Nokia 5310 Album Art? MattRoxx Audio 0 2008-01-17 16:42
IS Symbian a Multitasking OS? IS it event driven ? kmkri Bluetooth Technology 0 2002-09-17 11:38
Ringtones for 6020 JessCC Audio 2 2006-12-19 18:52
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZpythonQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX