Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - strange Problem related to service

strange Problem related to service

Put your problem here if it does not fit any of the other categories.

strange Problem related to service

Postby Nemat » Thu Oct 08, 2009 12:20 pm

Hi....

I am presently working on services.I am facing a strange problem.I have to start a service on boot completed.First I wrote the code in service:
Code: Select all
public class BackgroundService extends Service{
   /**
     * Delay until first exeution of the Log task.
     */
    private final long mDelay = 0;
    /**
     * Period of the Log task.
     */
    private final long mPeriod = 500;
    /**
     * Log tag for this service.
     */
    private final String LOGTAG = "BootDemoService";
    /**
     * Timer to schedule the service.
     */
    private Timer mTimer;
   
    /**
     * Implementation of the timer task.
     */
    private class LogTask extends TimerTask {
     public void run() {
      Log.i(LOGTAG, "scheduled");
      Log.i("BOOTDEMOPPROCESS", "scheduled111111111");
     }
    }
    private LogTask mLogTask;
   @Override
   public IBinder onBind(Intent intent) {
      // TODO Auto-generated method stub
      return null;
   }
    @Override
    public void onCreate() {
     super.onCreate();
     Log.i(LOGTAG, "created");
     Log.i("BOOTDEMOPPROCESS", "created222222");
    mTimer = new Timer();
     mLogTask = new LogTask();
    }
   
    @Override
    public void onStart(final Intent intent, final int startId) {
     super.onStart(intent, startId);
     Log.i(LOGTAG, "started");
    mTimer.schedule(mLogTask, mDelay, mPeriod);
    }


}


Then I changed this code into the following lines of code:
Code: Select all


public class RunService extends Service{
   
   
   @Override
   public IBinder onBind(Intent intent) {
      // TODO Auto-generated method stub
      return null;
   }
    @Override
    public void onCreate() {
     super.onCreate();
     Log.i("LOGTAG", "created");
     Log.i("BOOTING", "I have created");
   
    }
   
    @Override
    public void onStart(final Intent intent, final int startId) {
     super.onStart(intent, startId);
     Log.i("LOGTAG", "started");
        
    }
   
   
}



Now that I have changed the code and removed all the lines related to Timer but I still got "scheduled" and "scheduled111111" writen into the log.......even I created another project nad copied and pasted the new code into that but I still got the same problem in my new project.....

I dont know whats the reason......I am attaching my complete code here.

Please help.....

Thanks
Nemat
Attachments
RunServiceInBackground.zip
(34.64 KiB) Downloaded 41 times
Nemat
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Thu Aug 21, 2008 3:16 pm
Location: Jaipur

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 10 guests