title: Android-How to start and keep service running after first app launch?
body: <p>I am creating a database on first launch and on a button click I will insert values in the table.Now on that button click itself I will start a service by startService() method,that service will continuously be checking particular column values of table eternally till I explicitly stop service.My question is how to start and keep this service running after first insertion click that I do?Thanks.</p>
  
  <pre><code>    Button save=(Button)findViewById(R.id.save);
      save.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
                //MainActivity ma=new MainActivity();
                event=spinner.getSelectedItem().toString();
                message=ed1.getText().toString();
                MainActivity.myDataBase.openDatabase("/data/data/package/databases/table", null,MainActivity.myDataBase.OPEN_READWRITE);
                MainActivity.myDataBase.execSQL("INSERT INTO " +
                  MainActivity.tablename +
                          " Values ('"+ val1 +"','"+ val2 +"','"+ val3 +"','"+ val4 +"','"+ val5 +"');");
  
          }
  
      });
  }
  </code></pre>
  
  <p>After that 'insert' I would like to start service to 'select' a particular column from the table that I just inserted records into and let that service run forever.Also it should not restart again when press I that same button to save another recors.</p>
  
  <p>PS:I could make another button to start the service but I want to do all activities in one click and not tarnish the user experience.</p>