android - CallLog.Calls.DURATION gives different result in different devices -
I have created an Android app, in which I want the last call description of the number
Using CallLog.Calls.DURATION I get the final call details.
My code is -
stringbuffer sb = new stringbuffer (); Uri Contact = Call Log Call. CONTENT_URI; Cursor Managed Kaiser = Reference. Telecommunication Receiver () Query (contact, empty, empty, null, empty); Int number = Managed Kaiser.Gate column index (call log call number); Int type = managed cassaror.gate column index (call log call.Tepee); Int date = managed cccore. Est column index (call log call.date); Int. Duration = Managed CASCORE. Est column index (call log call. Sb.append ("Call Details:"); If (managedCursor.moveToFirst ()) {string phNumber = managedCursor.getString (number); String call type = managed quasar .getString (type); String CallDet = Managed Kaiser .getString (date); String CallDetium = New Date (Long.View (Called)). ToString (); // long timestamp = convert datestamp (calldeterm); String Call Draction = Managed Kaiser .getString (Duration); Int calld = integer Paradigm (collusion); String dir = null; Int dircode = integer.percent (call type); Switch (DICRcode) {case call calls.UUTOGOOGH: DIUR = "Outputing"; break; Case call log. Call. INCOMING_TYPE: dir = "INOMING"; break; Case calllog.Calls.MISSED_TYPE: dir = "MISSED"; break; } Sb.append ("\ n Phone Number: ---" + Phone Number "\ n Call Type: ---" + DIR + "\ nDate Call: ---" + CallData + "\ nIn seconds Call duration: - - "+ Sealed); Sb.append ("\ n ------------------------------"); } ManagedCursor.close (); Println (sb);
In a device, I get the last call description using managedCursor.moveToFirst ()
and in the other tool I get the managedCursor.moveToLast () I get the last call details using
.
How to obtain it using a single code?
You can add an order buy clause to place an order to land.
Cursor managed cursor = context.getContentResolver (). Query (contact, blank, empty, empty, call log.calls.DEFAULT_SORT_ORDER);
OR
Cursor managed coscore = context.gate content resolver (). Query (contact, blank, blank, empty, call log .date + "DESC");
Comments
Post a Comment