我正在尝试在我的Android应用程序中加载LINE联系人列表,并在点击特定联系人时打开聊天屏幕。我可以打开聊天屏幕,但我必须手动点击联系人才能开始与联系人聊天。我已经阅读了 https://developers.line.me/en/docs/line-login/using-line-url-scheme/的可用信息。但这并没有帮助我。另外,我也找不到线路联系人列表。运行程序时出现空字符串。
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);
根据文档,您在寻找的内容似乎是不可能的。
以下是LINE应用程序的可用URL方案列表:
- 打开相机和相机胶卷
- 打开位置屏幕
- 共享机器人帐户
- 打开机器人时间线和帐户页面
- 发送短信
- 打开个人资料信息
- 打开常见的LINE应用程序屏幕
- 打开LINE应用设置界面 打开
- 贴纸店 开设主题商店
- 使用线路输出拨打电话
有关更多详细信息,请查看此处
因此,新的文档是可能的...
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://line.me/R/oaMessage/" + "@lineId/"+"?"+"Hi%20there%21"));
context.startActivity(intent);
指 https://developers.line.biz/en/docs/line-login/using-line-url-scheme/#sending-text-messages