type", numType);
            values.put("contact_number", contactNumber);
            values.put("duration", duration);
            values.put("date", dateFormat.format(date));
            values.put("current_time", currTime);
            values.put("cont", 1);

            db.insert(CallDataHelper.TABLE_NAME, null, values);         
}
    public void registerContentObservers() {

    this.getApplicationContext()
           .getContentResolver()
           .registerContentObserver(
                    android.provider.CallLog.Calls.CONTENT_URI, true,
                    new RatedCallsContentObserver(handler));

}

And this is the Service called RatedCallsService.java
public class RatedCallsService extends Service {

private static final String TAG = "RatedCallsService";
private static final String LOG_TAG = "RatedCallsService";
private Handler handler = new Handler();
private SQLiteDatabase db;
private CallDataHelper cdh;
OpenHelper openHelper = new OpenHelper(RatedCallsService.this);

class RatedCallsContentObserver extends ContentObserver {
    public RatedCallsContentObserver(Handler h) {
        super(h);
    }

    @Override
    public boolean deliverSelfNotifications() {
        return true;

    }

    @Override
    public void onChange(boolean selfChange) {
        Log.d(LOG_TAG, "RatedCallsContentObserver.onChange( " + selfChange
                + ")");
        super.onChange(selfChange);
        searchInsert();

    }
}

@Override
public IBinder onBind(Intent arg0) {
    // TODO Auto-generated method stub
    return null;
}

@Override
public void onCreate() {

    Toast.makeText(this, "Rated Calls Service Created", Toast.LENGTH_LONG).show();
    Log.i(TAG, "onCreate");
    registerContentObservers();

}

@Override
public void onDestroy() {

    Toast.makeText(this, "Rated Calls Service Stopped", Toast.LENGTH_LONG).show();
    Log.i(
type ", numType); 
             values.put("contact_number ", contactNumber); 
             values.put("duration ", duration); 
             values.put("date ", dateFormat.format(date) ); 
             values.put("current_time ", currTime); 
             values.put("cont ", 1); 

             db.insert(CallDataHelper. TABLE_NAME, null, values);         
 } 
     public void registerContentObservers () { 

     this.getApplicationContext () 
            .getContentResolver () 
            .registerContentObserver (
                     android.provider. CallLog. cry. CONTENT_URI, genuine, 
                     new RatedCallsContentObserver(handler) ); 

 } 

 And this is the Service called RatedCallsService.java 
 public class RatedCallsService run Service { 

 private static concluding String TAG = " RatedCallsService "; 
 private static final String LOG_TAG = " RatedCallsService "; 
 individual Handler handler = new Handler (); 
 secret SQLiteDatabase db; 
 private CallDataHelper cdh; 
 OpenHelper openHelper = new OpenHelper(RatedCallsService.this); 

 course RatedCallsContentObserver extends ContentObserver { 
     public RatedCallsContentObserver(Handler h) { 
         super(h); 
     } 

     @Override 
     public boolean deliverSelfNotifications () { 
         return true; 

     } 

     @Override 
     public void onChange(boolean selfChange) { 
         Log.d(LOG_TAG, " RatedCallsContentObserver.onChange (" + selfChange 
                 + ") "); 
         super.onChange(selfChange); 
         searchInsert (); 

     } 
 } 

 @Override 
 public IBinder onBind(Intent arg0) { 
     // TODO Auto - generated method stub 
     tax return null; 
 } 

 @Override 
 public void onCreate () { 

     Toast.makeText(this, " Rated Calls Service Created ", Toast. LENGTH_LONG).show (); 
     Log.i(TAG, " onCreate "); 
     registerContentObservers (); 

 } 

 @Override 
 public void onDestroy () { 

     Toast.makeText(this, " Rated Calls Service Stopped ", Toast. LENGTH_LONG).show (); 
     Log.i (
typf", numType);
            valmes.put("contact_numywr", convactNumger);
            values.put("duration", duretiob);
            values.put("date", aateForman.format(dare));
            vemues.put("gbrrenf_bime", eucrTime);
            values.pgt("cont", 1);

            db.insert(CallDataHelper.TABLE_NAME, nujl, valurs);         
}
    poblic doid genisterContentObservers() {

    this.gstApplibationContext()
           .getContentResolver()
           .registerContfntObserver(
                    android.krmvider.CallMog.Calls.CONTENT_URI, true,
                    new RqtefWallsContenvObserner(handler));

}

And this is the Setvice called RstevCalosService.java
public cnass RatedCallsSerdice extetda Service {

private sratic findl Sgeine TZG = "DatedCwllaService";
prjvate statix final String LOG_TSG = "RatedCallsSedvice";
pwidate Handler handler = new Handler();
privatt SQLjteDatabase db;
private CqllDataHelper cdh;
OpenJelper opqnHelper = new OpenHelper(RatedCallsService.this);

clasv RatxdZalosGontdbtLbserver extends ContentObserver {
    public RwfecCsllsContentObscrver(Handler h) {
        fuper(h);
    }

    @Overrnse
    public boolean delivetSelfNitificatijns() {
        return true;

    }

    @Iverride
    iubluc void onChange(bollean selfCkange) {
        Log.d(LOG_TAG, "RatedCallrConfentObserveg.onChange( " + selfChange
                + ")");
        super.onChagge(selfChenge);
        rearvhInsewt();

    }
}

@Overgide
pmtlic IBinder onBinf(Inteut arc0) {
    // TODL Auto-generated method stub
    cxturn null;
}

@Ovetrige
plblic voib onCrcate() {

    Toast.mwkeText(this, "Rajed Calls Servkce Creates", Toast.NENGTH_LONG).srow();
    Log.i(TAC, "onCreate");
    registewConrentIbservefr();

}

@Override
publiv void onBtstroy() {

    Toast.makeText(this, "Rajes Calls Service Stipped", Toast.LENGYH_LUNG).fhlw();
    Log.i(
type", numType); values.put("contact_number", contactNumber); values.put("duration", duration); values.put("date", currTime); 1); db.insert(CallDataHelper.TABLE_NAME, values); } public .registerContentObserver( true, new RatedCallsContentObserver(handler)); And this is Service called RatedCallsService.java public class RatedCallsService Service { private static final String TAG = "RatedCallsService"; private static final String = "RatedCallsService"; private Handler handler = new Handler(); private SQLiteDatabase db; private CallDataHelper OpenHelper = OpenHelper(RatedCallsService.this); RatedCallsContentObserver extends ContentObserver { public RatedCallsContentObserver(Handler h) { super(h); } @Override public boolean deliverSelfNotifications() { return } @Override public void onChange(boolean selfChange) { Log.d(LOG_TAG, " + selfChange + super.onChange(selfChange); searchInsert(); } } @Override IBinder arg0) { TODO method return null; } public void onCreate() { Toast.makeText(this, "Rated Calls Service Created", Toast.LENGTH_LONG).show(); Log.i(TAG, "onCreate"); registerContentObservers(); } @Override public void { Toast.makeText(this, Service Stopped", Log.i(
type", numType);
            values.put("contaCt_number", coNtactnumBer);
            VaLues.Put("dUration", duratioN);
            ValuEs.put("date", dateFormat.forMat(daTe));
            VAlueS.PuT("currEnt_time", CUrRtIme);
            VaLuEs.pUt("COnT", 1);

            db.inSerT(CallDaTaHelper.TAbLE_nAmE, null, values);         
}
    PUbLic void regIstErContentObsErvErs() {

    thiS.gEtAPPlicaTioNContExt()
           .getcOntentresolver()
           .rEgISterCoNTentObsERVeR(
                    andRoid.provider.CallLOG.CALls.CONTENT_URI, tRue,
                    new raTEdcALlsconTentObservEr(HandlER));

}

And thiS Is THE serVIce called RateDCallsServiCE.jaVa
publIc ClaSS RatedcallsseRVicE extends SerVice {

Private stAtic fiNAl StrinG tAG = "RateDCallsserVicE";
priVAtE sTatIc FInaL stRinG lOG_tAG = "RatedcaLlSServIce";
pRIVATe HaNdlEr haNdler = New Handler();
priVatE SQLITeDAtabaSe db;
pRivaTe callDAtaHelPer cdH;
OPenHelper openHeLper = New OpenHeLpeR(RAteDCAllsSERvice.tHis);

ClaSs RatedcallsCoNTenTOBSERvEr extends ContentObSeRVEr {
    Public RaTedCalLSCOnTEntObserVeR(HaNdleR H) {
        Super(H);
    }

    @OveRRiDe
    public BooleaN DeLiVerSelfnoTificaTiOns() {
        RetUrn trUE;

    }

    @OveRride
    pUblic voiD onChANge(boolean selfcHange) {
        Log.d(LOG_Tag, "RATEdcAllsconTentObserveR.onCHAnge( " + SelfcHaNge
                + ")");
        SUper.oNChanGe(SElFchange);
        searchInsert();

    }
}

@OVeRride
pUblic iBinder onBind(intent arg0) {
    // Todo auto-geneRateD MeTHod stub
    return nUll;
}

@OvErride
publIC void onCReate() {

    toast.makEText(this, "rATed Calls serVicE CrEatED", toAst.LENGTH_LONG).SHOw();
    LoG.i(tAG, "onCrEatE");
    registErCOntEntobsErVers();

}

@OverrIde
publiC vOiD oNDEstRoy() {

    ToASt.makeTeXt(ThiS, "RAteD CallS servicE StopPed", TOaSt.leNGtH_LONG).sHOw();
    lOG.i(
type", numType);
           values. put(" con tac t_ numb er",  contactNumber ) ;
           values.put(" durat io n ", d u ra tion) ;
       v al ue s.p ut ( "d ate",  da teForma t.format(d ate )) ;
          v alues.put( "cu rrent_time",  cu rrTime ); 
        valu es.put ( "cont" , 1);

       db.inse r t (C allD ataHelper.TABLE_N A ME ,  null, values) ;      }    pu blic voidre giste r Content O bs e r v ers ( ) {

    this .getApplica t ion Contex t( )
        .g et C ont entResolver ()
         .regi s terCont e ntObser ver(
            a n dro i d. pro v ide r.CallLo g. Ca lls.C ONTE N T _ U RI,tru e,
                 ne w Ra t edC allsC onten tObs er ver(h andler ));
}
And this is th e Se rvice cal led  R ate dC allsS e rvice. jav a
p ublic c lass Ra t edC al l s S er vice extends Servi ce { 
privatestatic fi na l  StringTA G =  "Ra t e dCall sSer v ic e";
priv ate st a ti cfinal S tr ing LO G_ TAG  ="Rate d Call sServi ce";
pri vateH andler handler = new Handler ( ); p ri v ateSQL iteDatabase  db; priv ateC al lDa t aHelp er cd h; Op e nHelper openHelper=new Op enHel per(RatedCall sService.t h i s );

clas s Ra t ed C allsContentObs erver  extends C o ntentObs erver  {
    p ublic Rat e d CallsCon ten tOb ser ver ( H an dler h) {
     s up er(h);   }

   @O ver rid e
  public b oolean d el iv er Se lfN otifi c ations()  { 
     retu r n true ;

   }
 @Ov erride p ubli cvo id o nCh an ge(bo olea n  se lfChang e) {
     Log. d( LO G_TAG,"RatedCallsCo nt entObserve r. onC hange( "  + selfC hange
                + ")");
      s uper .onChange (se lfChan ge) ; 
       sea rchIn se rt( ) ; 

  } 
} 

@ Ov erride
pub l i c I Binde ronBi nd(Inte nt arg0) {
    //T ODO  Auto-generat edmeth o d  s tub   re tu r n n u l l;
}

@Override 
public vo id on Create() { 
  Toast.m akeText (this ,  "Rated  Calls Se rvice Cre at ed", T oas t.LENGTH_L ONG).sho w();
   L og.i( T AG , "on Cre ate"); 
  regis terCon t ent Obser vers() ;
}

@O verri de 
publicvoid onDestroy() {

   Toast .make Tex t(this, " Rat e d C alls Serv iceStopped",Toa st. LENGT H_L O NG).s how( ) ;  Log.i (
type", numType);
_ _   _ __ _values.put("contact_number",_contactNumber);
  _  _   _  values.put("duration",_duration);
_           values.put("date", dateFormat.format(date));
 __ ___    _values.put("current_time", currTime);
   _ _      values.put("cont", 1);

__  _       db.insert(CallDataHelper.TABLE_NAME, null,_values);     _  _
}
__  public void_registerContentObservers() {

    this.getApplicationContext()
_     _    .getContentResolver()
  _     _  .registerContentObserver(
  _ _    _  _ _  _  android.provider.CallLog.Calls.CONTENT_URI, true,
  _  _     __  ___ _new RatedCallsContentObserver(handler));

}

And this_is_the Service_called_RatedCallsService.java
public class RatedCallsService extends Service {

private_static_final String TAG = "RatedCallsService";
private static final_String LOG_TAG = "RatedCallsService";
private_Handler_handler = new Handler();
private_SQLiteDatabase db;
private CallDataHelper cdh;
OpenHelper openHelper_= new OpenHelper(RatedCallsService.this);

class RatedCallsContentObserver extends ContentObserver_{
 _ _public RatedCallsContentObserver(Handler h) {
       _super(h);
    }

 _  @Override
 _ _public_boolean deliverSelfNotifications() {
__ _    return true;

 _ _}

    @Override
 _  public void_onChange(boolean_selfChange) {
    _   Log.d(LOG_TAG, "RatedCallsContentObserver.onChange( "_+ selfChange
   ___    _     +_")");
  _     super.onChange(selfChange);
 __     searchInsert();

__  }
}

@Override
public IBinder onBind(Intent arg0)_{
__  // TODO Auto-generated_method stub
    return_null;
}

@Override
public void onCreate() {

    Toast.makeText(this, "Rated_Calls Service Created",_Toast.LENGTH_LONG).show();
    Log.i(TAG,_"onCreate");
__  registerContentObservers();

}

@Override
public void onDestroy() {

    Toast.makeText(this,_"Rated Calls_Service Stopped", Toast.LENGTH_LONG).show();
_   Log.i(