Waheed Abbas
Waheed Abbas

Reputation: 185

Open chat screen of LINE android app with a specific contact

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

Upvotes: 2

Views: 2602

Answers (2)

rawcoder064
rawcoder064

Reputation: 1384

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

Upvotes: 1

Vikasdeep Singh
Vikasdeep Singh

Reputation: 21766

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

Upvotes: 3

Related Questions