【发布时间】:2018-12-08 18:44:25
【问题描述】:
我正在尝试在我的 Android 应用程序中加载 LINE 联系人列表,并在点击时打开与特定联系人的聊天屏幕。我可以打开聊天屏幕,但我必须手动点击联系人才能开始与联系人聊天。我已阅读来自https://developers.line.me/en/docs/line-login/using-line-url-scheme/ 的可用信息。但这并没有帮助我。另外,我也找不到 Line 联系人列表。运行程序时得到一个空字符串。
Cursor cursor = getContentResolver().query(
RawContacts.CONTENT_URI,
new String[] { RawContacts.CONTACT_ID, RawContacts.DISPLAY_NAME_PRIMARY },
RawContacts.ACCOUNT_TYPE + "= ?",
new String[] { "jp.naver.line.android" },
null);
ArrayList<String> LineContacts = new ArrayList<String>();
int contactNameColumn = cursor.getColumnIndex(RawContacts.DISPLAY_NAME_PRIMARY);
while (cursor.moveToNext())
{
LineContacts.add(cursor.getString(contactNameColumn));
}
cursor.close();
Log.d(TAG,LineContacts.size());
使用意图打开线路应用程序。
String sendText = "line://nv/chat";
Intent intent = new Intent();
try {
intent = Intent.parseUri(sendText, Intent.URI_INTENT_SCHEME);
} catch (URISyntaxException e) {
e.printStackTrace();
}
startActivity(intent);
【问题讨论】:
标签: java android android-intent android-contacts line-api