title: run app in background without activity alerts user when Contact or sms is deleted
body: <p>i want to make my app to be run in background and listens for 
  contact,sms deletion events.
  for that i created a service in my app but i dnt how to start without activity 
  my code is like this</p>
  
  <pre><code>public class DeleteService extends Service {
  
  ContentResolver cr;
  
   MyContentObserver observer=new MyContentObserver();
  @Override
  public IBinder onBind(Intent arg0) {
      // TODO Auto-generated method stub
      return mBinder;
  }
  @Override
  public void onCreate() {
  
       cpath=ContactsContract.Contacts.CONTENT_URI;
  
                  // some action
          }
  
  @Override
  
  public void onDestroy() {
  
  }
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
  // TODO Launch a background thread to do processing.
      super.onStartCommand(intent, flags, startId);
      cpath=ContactsContract.Contacts.CONTENT_URI;
      cr=getContentResolver();
      cur=cr.query(cpath, null, null, null, null);
  
  
      this.getApplicationContext().getContentResolver().registerContentObserver(cpath, true, observer);
      return Service.START_STICKY;
  
      }
   private class MyContentObserver extends ContentObserver {
  
          public MyContentObserver() {
              super(null);
          }
  
          @Override
          public void onChange(boolean selfChange) {
              super.onChange(selfChange);
              nfm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
              int NOTIFICATION_ID = 1;
         Intent intent1 = new Intent();
         PendingIntent pi = PendingIntent.getActivity(DeleteService.this, 1, intent1, 0);
         nf=new Notification(R.drawable.ic_launcher,"Contact Database changed",System.currentTimeMillis());
         nf.setLatestEventInfo(getApplicationContext(), "Delete Event", "contact name", pi);
         nf.flags = nf.flags |
               Notification.FLAG_ONGOING_EVENT;
      }
          @Override
          public boolean deliverSelfNotifications()
          { 
               super.deliverSelfNotifications();
              return true;
  
          }
  }
   public class LocalBinder extends Binder {
          DeleteService getService() {
              return DeleteService.this;
          }
  
  }
  }
  </code></pre>