get last Call on CallLog using a Service

血红的双手。 提交于 2019-12-04 18:24:23

Add a ContentObserver on call log which will notify you when anything is changed in callLog i.e. if new call is added to call log or you removed the call log

EDIT

Try this get new call log after call finishes I am getting right result with this code

Wait for 3-4 seconds after call finish and then

CursorLoader cursorLoader = new CursorLoader(mActivity,
            CallLog.Calls.CONTENT_URI, null, null, null, null);
managedCursor = cursorLoader.loadInBackground();


int durationIndex = managedCursor.getColumnIndex(CallLog.Calls.DURATION);

managedCursor.moveToFirst();

String duration =managedCursor.getString(duration)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!