CallLog(){
var CallLog = window.plus.android.importClass('android.provider.CallLog');
var Activity = window.plus.android.runtimeMainActivity();
var ContentResolver = window.plus.android.importClass('android.content.ContentResolver');
var resolver = Activity.getContentResolver();
window.plus.android.importClass(resolver);
var String = window.plus.android.importClass("java.lang.String");
var cs = resolver.query(CallLog.Calls.CONTENT_URI, null, null, null, CallLog.Calls.DEFAULT_SORT_ORDER);
var talist = [];
var count = 0; // 记录多少条 用于处理循环跳出
while (window.plus.android.invoke(cs, "moveToNext")) {
count++;
talist.push({
xm: window.plus.android.invoke(cs, "getString", window.plus.android.invoke(cs, "getColumnIndex", CallLog.Calls.CACHED_NAME)),
telphone: window.plus.android.invoke(cs, "getString", window.plus.android.invoke(cs, "getColumnIndex", CallLog.Calls.NUMBER)),
duration: window.plus.android.invoke(cs, "getString", window.plus.android.invoke(cs, "getColumnIndex", CallLog.Calls.DURATION)),
date: this.$utils.formatFullTime(window.plus.android.invoke(cs, "getString", window.plus.android.invoke(cs, "getColumnIndex", CallLog.Calls.DATE))),
type: window.plus.android.invoke(cs, "getString", window.plus.android.invoke(cs, "getColumnIndex", CallLog.Calls.TYPE))
});
if(count > 10){
break;
}
}
console.info("talist",JSON.stringify(talist));
},
0 个回复