Android的加入号码通话记录

Android的加入号码通话记录

本文介绍了Android的加入号码通话记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是由反正可以编写调用日志数据库?我的意思是我要选择的号码添加到通话记录。我试图寻找网上的教程,但找不到任何...虽然1件事是肯定的,是可以做到的。怎么我看到了很多的应用程序联机,它恢复通话记录,所以我想我们能以某种方式修改通话记录数据库(但究竟如何并不清楚我)。

Is it by anyway possible to write to call logs database?? I mean i want to add selected numbers to the call history. I tried searching the tutorial on net but couldn't find any... Though 1 thing is for sure, IT CAN BE DONE. coz i have seen lots of applications online, which restore call logs, so i guess we can modify the call history database somehow(but how exactly is not clear with me).

我已经阅读这篇文章却偏偏要贴很长一段时间了。

i already read this post but it happens to be posted a long time back.

任何帮助将AP preciated!感谢名单!

Any help will be appreciated! Thanx!

推荐答案

您可以使用此code到新记录添加到现有呼叫日志内容提供商:

You can use this code to add new records to the existing Call logs content provider:

public static void insertPlaceholderCall(ContentResolver contentResolver, String number){
    ContentValues values = new ContentValues();
    values.put(CallLog.Calls.NUMBER, number);
    values.put(CallLog.Calls.DATE, System.currentTimeMillis());
    values.put(CallLog.Calls.DURATION, 0);
    values.put(CallLog.Calls.TYPE, CallLog.Calls.OUTGOING_TYPE);
    values.put(CallLog.Calls.NEW, 1);
    values.put(CallLog.Calls.CACHED_NAME, "");
    values.put(CallLog.Calls.CACHED_NUMBER_TYPE, 0);
    values.put(CallLog.Calls.CACHED_NUMBER_LABEL, "");
    Log.d(TAG, "Inserting call log placeholder for " + number);
    contentResolver.insert(CallLog.Calls.CONTENT_URI, values);
}

(code取自谷歌语音回调的Andr​​oid

记住要添加的权限在清单

Remember to add the permissions in the Manifest

<uses-permission
    android:name="android.permission.READ_CONTACTS"></uses-permission>
<uses-permission
    android:name="android.permission.WRITE_CONTACTS"></uses-permission>

这篇关于Android的加入号码通话记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 14:56