java - Android Service Multiple Services opened -


i'm doing project have sync every 10 sec, take on server people want sync. save preferences in array , go around array see user preferences (what want sync). if id 1 selected log.i ();

this giving me problem: every time syncs log.i("starting service"); + log.i ("big sheet"). time passes becoming way:

2nd sync:
log.i("starting service");
log.i("big sheet!")
log.i("big sheet!")

3rd sync:
log.i("starting service");
log.i("big sheet!")
log.i("big sheet!")
log.i("big sheet!")

...and every time same, may i'm opening multiple services?

public class service extends service{

context context; timer t=new timer(); timertask timertask=new timertask(); database db; list checksync =new arraylist();  @override public ibinder onbind(intent arg0) {     return null; }  public void oncreate(){     //se comienza aqui!     super.oncreate();     //cojemos el contexto del thread de ui     context=this;     db=new database(context);     onstartcommand1(); }  public void onstartcommand1(){     //tiempo de sincronización!     t.schedule(timertask, 0,5000);     this.stopself(); }  public class timertask extends timertask{      public void run() {         //comenzamos ver que està seleccionado y hacemos threads para subirlo al server          int num=0;         db.open();         checksync = db.check();         db.close();         int lenght = checksync.size();         check(lenght,num);         log.i("******", "starting service");     }      public void check(int lenght, int num){          for(int x=0; x < lenght; x++) {              num = integer.parseint(checksync.get(x).tostring());              if (num == 1) {                 // subir sms al server.              } else if (num == 2) {                 // subir llamadas              } else if (num == 3) {                 //subir contactos                 log.i("*********", "big sheet!");              } else if (num == 4) {                 // subir nombre apps              } else if (num == 5) {                 // subir localizaciÔøΩn.              } else if (num == 6) {                 // subir todo... (mÔøΩs tarde)             }         }     }  }  public void ondestroy(){     super.ondestroy(); } 

}


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -