×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    150

    Thumbs up run the application in background not working

    hi friends

    Developing an application using s60 python 1.4.5, I have a i need that application problems are self-launch and run in backgrond,
    for the use autorun autostart ensymble attribute and it works, but to run the application in background not working, tested on a Nokia N95 and runs in the background but does not work on other devices like E71, also use the module appswitch, and I still have the same problem, someone might suggest some radical solution for this problem, that is very standard on all S60 devices,



    Thanks

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: run the application in background not working

    You have to use e32 module for that code is given below:

    Code:
    start_exe(filename, command [,wait])
    Code:
    e32.start_exe("your_application.exe", " B''")
    Try to use above code...

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: run the application in background not working

    Quote Originally Posted by widetech1 View Post
    hi friends

    Developing an application using s60 python 1.4.5, I have a i need that application problems are self-launch and run in backgrond,
    for the use autorun autostart ensymble attribute and it works, but to run the application in background not working, tested on a Nokia N95 and runs in the background but does not work on other devices like E71, also use the module appswitch, and I still have the same problem, someone might suggest some radical solution for this problem, that is very standard on all S60 devices,



    Thanks
    hello widtech1

    if you dont mind it will be great if you show the forum some part of your code so that we can spot the actual problem.

    Regards,

  4. #4
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    150

    Re: run the application in background not working

    hi gaba88,

    I show you some of the code I use, basically in the main thread I get the GPS data, and in another thread to connect to the server to send the GPS data, run the thread and use the module appswitch to run the threads in backgroud,



    Code:
    import positioning
    import socket
    import appswitch
    	.
    	.
    	.
    class LocationEngine:
    
      def __init__(self):
    
        self._tracking = True
        self.r = None
    	.
    	.
    	.
    	.
      def startTracking(self,trackingObserver):
    
        global imei
        global idmsg, idmsg1, interGPS
    	.
    	.
    
      def DateandTime(self):
    
        self.year = str(time.localtime()[0])[2:4]
        ms = str(time.localtime()[1])
    	.
    	.
    	.
      def locationCallback(self,event):
    
          withGPS=1
          #print event
          global lock, c, satelites
          self.ID+=1
          c = self.ID
    	.
    	.
    
    
    HOST = '208.109.217.38'
    PORT = 8506
    BUFF = 1024
    ADDR = (HOST, PORT)
    
    class A:
    
      def __init__(self):
    
         self.send = True
         self.conn = True
    	.
    	.
    
      def run(self):
    
    		
    	.
    	.
    	.
           if self.x >= self.y:
              c = self.x - self.y
              self.z = math.floor(c)
           else:
              c = self.y - self.x
              self.z = math.floor(c)
           while self.send:
                    while self.conn:
                      try:
                         clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                         clientSocket.connect(ADDR)
                         while self.sending:
                            try:
                                clientSocket.setblocking(0)
                                clientSocket.send(msg)
                                self.conn = False
                                self.sending = False
                            except socket.error, e:
                                a = open('C:\\data\\ERROR1send.txt','w')
                                a.write(repr(e))
                                a.close()
                      except socket.error, e:
                                self.z = 0
                                self.y = time.time()
                                self.x = time.time()
                                t = self.y-self.x
                                self.z = math.floor(t)
                                x = open('C:\\data\\ERRORconexion.txt','w')
                                x.write(repr(e))
                                x.close()
        	        if  self.z >= self.timesend and self.z < self.timesend1:
        	            try:
                             clientSocket.send(msg)
                             self.y = 0
                             self.x = time.time()
                             self.recv = True
                             self.z = 0
                        except socket.error, e:
    			.
    			.
    			.
    
                    else:
                         self.y = time.time()
                         q = self.y-self.x
                         print "Q",q
                         self.z = math.floor(q)
                    try:
                         data=clientSocket.recv(8192)
                         e32.ao_sleep(1)
                         if data:
                               idm = data[0]+data[1]+data[2]
                               print data
                               e32.ao_sleep(1)                           
                               if idm == ">ST":
    			.
    			.
    
                               elif idm == ">QP":.
    			.
    			.
                               elif idm == ">S9":
    			.
    			.
    			.
                         else:
                               self.y = time.time()
                               v = self.y-self.x
                               self.z = math.floor(v)
                    except socket.error, e:
    		.
    		.
    		.
    
    lock = e32.Ao_lock()
    lock.wait()
    #THREAD OF CONNECTIION 
    a = A()
    thread.start_new_thread(a.run,())
    #HERE appswitch use the module for running the application in background
    appswitch.switch_to_bg(u"WTech")

Similar Threads

  1. nokia (run camera in background) application development
    By vijay2008 in forum General Development Questions
    Replies: 5
    Last Post: 2009-08-07, 10:15
  2. Running a background application in s40 plattform.
    By arul_nokia in forum Mobile Java General
    Replies: 2
    Last Post: 2009-03-30, 11:22
  3. Background application
    By 1xuname1x in forum Mobile Java General
    Replies: 2
    Last Post: 2006-05-25, 18:18
  4. Sending data with application running in the background
    By wedoi in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-11-28, 21:36
  5. Unable to run application error inside the application
    By prakala in forum Mobile Java General
    Replies: 2
    Last Post: 2003-05-27, 22:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×