2

I am trying to load the list of LINE contacts in my Android application and open chat screen with the specific contact on tapping it. I can open the chat screen but I have to manually tap the contact to start the chat with the contact. I have read the available information from https://developers.line.me/en/docs/line-login/using-line-url-scheme/. But it didn't help me out. Also, I cannot find the list of Line contacts either. I get an empty string when I run the program.

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());

Opening the line app using intent.

    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);
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Waheed Abbas
  • 187
  • 1
  • 4
  • 18

2 Answers2

3

As per the documentation it looks not possible what are you looking for.

Below is list of the available URL schemes for the LINE app:

  1. Opening the camera and camera roll
  2. Opening the location screen
  3. Sharing your bot account
  4. Opening your bot Timeline and account page
  5. Sending text messages
  6. Opening profile information
  7. Opening common LINE app screens
  8. Opening LINE app settings screens Opening the
  9. Sticker Shop Opening the Theme Shop
  10. Making phone calls with LINE Out

For more details check here

Vikasdeep Singh
  • 20,983
  • 15
  • 78
  • 104
  • But there is an app called drupe(https://play.google.com/store/apps/details?id=mobi.drupe.app&hl=en) which has this functionality in it. – Waheed Abbas Jun 29 '18 at 14:44
1

Accordingly new documentation it is possible...

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);

Refers to https://developers.line.biz/en/docs/line-login/using-line-url-scheme/#sending-text-messages

rawcoder064
  • 1,374
  • 3
  • 11
  • 26