有谁知道未接来电的意图是什么。实际上,我想在我的应用程序中发送有关未接来电和来电的短信。
您需要使用 ContentObserver
public class MissedCallsContentObserver extends ContentObserver
{
public MissedCallsContentObserver()
{
super(null);
}
@Override
public void onChange(boolean selfChange)
{
Cursor cursor = getContentResolver().query(
Calls.CONTENT_URI,
null,
Calls.TYPE + " = ? AND " + Calls.NEW + " = ?",
new String[] { Integer.toString(Calls.MISSED_TYPE), "1" },
Calls.DATE + " DESC ");
//this is the number of missed calls
//for your case you may need to track this number
//so that you can figure out when it changes
cursor.getCount();
cursor.close();
}
}
在您的应用程序中,您只需执行以下操作:
MissedCallsContentObserver mcco = new MissedCallsContentObserver();
getApplicationContext().getContentResolver().registerContentObserver(Calls.CONTENT_URI, true, mcco);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)