You are getting the error on startManagingCursor because that method
does not exist in a Service.
Leave that out and make sure you close the cursor when you are done
with it.

On Oct 12, 11:00 am, "Roman ( T-Mobile USA)" <roman.baumgaert...@t-
mobile.com> wrote:
> You should be able to measure the time between multiple
> onCallStateChanged events.
>
> In case of an outgoing call the state would switch from IDLE to
> CAll_STATE_OFFHOOK to to IDLE again.
>
> --
> Roman Baumgaertner
> Sr. SW Engineer-OSDC
> ·T· · ·Mobile· stick together
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Oct 12, 3:14 am, Nemat <[email protected]> wrote:
>
> > Hi friends,
>
> > Actually I was working to get duration of outgoing call.But I dont
> > find any way of doing this.Then I decided to get the details of
> > outgoing call from call log.
>
> > But my code works only for Activity.I want this to work with Services
> > because I want to get the details related to outgoing call in
> > background using services.What should I do to get these details in
> > background.I currently implement it for Activity.Here is my complete
> > code:
> > public void outgoingRecord()
> >   {
> >           Cursor c = getContentResolver().query(
> >               android.provider.CallLog.Calls.CONTENT_URI,
> >               null,
> >               null,
> >               null,
> >               android.provider.CallLog.Calls.DATE+ " DESC");
> >           startManagingCursor(c);
>
> >   int numberColumn = c.getColumnIndex(
> >           android.provider.CallLog.Calls.NUMBER);
> > int dateColumn = c.getColumnIndex(
> >           android.provider.CallLog.Calls.DATE);
> > // type can be: Incoming, Outgoing or Missed
> > int typeColumn = c.getColumnIndex(
> >           android.provider.CallLog.Calls.TYPE);
> > int durationColumn=c.getColumnIndex(
> >         android.provider.CallLog.Calls.DURATION);
>
> > // Will hold the calls, available to the cursor
> > ArrayList<String> callList = new ArrayList<String>();
>
> > try{
> > boolean moveToFirst=c.moveToFirst();
> > Log.d("MOVETOFIRST", "moveToFirst="+moveToFirst);}
>
> > catch(Exception e)
> > {
> >           Log.e("MOVETOFIRSTERROR","MOVETOFIRST Error="+e.toString());
>
> > }
>
> >          String callerPhoneNumber = c.getString(numberColumn);
> >          int callDate = c.getInt(dateColumn);
> >          int callType = c.getInt(typeColumn);
> >          int duration=c.getInt(durationColumn);
>
> >          Log.d("CALLS", "callDate="+callDate);
>
> >              switch(callType){
> >               case android.provider.CallLog.Calls.INCOMING_TYPE:
>
> >                           Log.d("INCOMINGCALLLOG", "CallerPhoneNum="+
> > callerPhoneNumber+" "+"Duration="+duration);
>
> >                                 break;
> >               case android.provider.CallLog.Calls.MISSED_TYPE:
> >                                   break;
> >               case android.provider.CallLog.Calls.OUTGOING_TYPE:
> >                              Log.d("OUTGOINGCALLLOG",
> > "CallerPhoneNum="+ callerPhoneNumber+" "+"Duration="+duration);
> >                                  break;
>
> > }
>
> >   }
>
> > I got error in "  startManagingCursor(c)".
>
> > Should I use another way to do this?If yes,What would be that way?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to