gpt4 book ai didi

java - Android/Blackberry10 通话信息不显示

转载 作者:行者123 更新时间:2023-12-01 13:16:54 25 4
gpt4 key购买 nike

我制作了一个 Android 应用程序,正在尝试将其移植到 Blackberry 10 设备上。目前,该应用程序的所有功能都可以使用,除了一个功能,我尝试从手机中获取有关最近通话的信息​​。这在 Android 上运行良好,但在我使用的黑莓 10 模拟器上似乎不起作用。这是我的该部分的代码:

final TextView time = (TextView) findViewById(R.id.AddNewEditTextTime);
final TextView date = (TextView) findViewById(R.id.AddNewEditTextDate);
final TextView number = (TextView) findViewById(R.id.AddNewEditTextNumber);

// fields to select.
String[] strFields = { android.provider.CallLog.Calls.NUMBER,
android.provider.CallLog.Calls.TYPE,
android.provider.CallLog.Calls.CACHED_NAME,
android.provider.CallLog.Calls.CACHED_NUMBER_TYPE,
android.provider.CallLog.Calls.DATE};

// only incoming.
String strSelection = android.provider.CallLog.Calls.TYPE + " = "
+ android.provider.CallLog.Calls.INCOMING_TYPE;

// most recent first
String strOrder = android.provider.CallLog.Calls.DATE + " DESC";

// get a cursor.
Cursor mCallCursor = getContentResolver().query(
android.provider.CallLog.Calls.CONTENT_URI, // content provider
// URI
strFields, // project (fields to get)
strSelection, // selection
null, // selection args
strOrder // sortorder.
);

if (mCallCursor.moveToFirst()) {
String a = mCallCursor.getString(mCallCursor
.getColumnIndex("date"));
String b = mCallCursor.getString(mCallCursor
.getColumnIndex("number"));
mCallCursor.close();

SimpleDateFormat dateF = new SimpleDateFormat("dd-MMM-yyyy");
SimpleDateFormat timeF = new SimpleDateFormat("HH:mm");
String dateString = dateF.format(new Date(Long
.parseLong(a)));
String timeString = timeF.format(new Date(Long
.parseLong(a)));
time.setText(timeString);
date.setText(dateString);
number.setText(b);
}

在 blackberry 10 设备上永远不会输入 if(mCallCursor.moveToFirst()) 语句,但在 Android 上运行良好。我是否遗漏/做错了什么,或者没有办法在黑莓 10 设备上使用像这样的 android.provider 函数?

最佳答案

显然尚不支持访问通话记录

This is not supported, the Android API is not hooked up to retreive this data.

Edit: Usually when there's an equivalent native API, the corresponding API in Android will be supported. The Android API almost always uses the native equivalent for its implementation. AFAIK there isn't a native call logs API.

作者:bbenninger,地址:support forums

关于java - Android/Blackberry10 通话信息不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22395167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com