-1

I want to navigate from my android app to hangouts text messages chat. i already have the google user/ id of the user i would like to chat with, but i found only video hangouts api examples. is it possible at all? thank you very much.

2 Answers2

1

If you're opening it with any conversation number, try to write code like this:

            String number = "9876543210"

            Uri uri = Uri.parse("smsto:" + number);
            Intent i = new Intent(Intent.ACTION_SENDTO, uri);
            i.setPackage("com.google.android.talk");
            startActivity(Intent.createChooser(i, ""));
            }
piotrek1543
  • 19,130
  • 7
  • 81
  • 94
Abhishek
  • 1,654
  • 2
  • 18
  • 31
0

It is not possible to open the Hangout chat for a specific contact through Android Intent.

We are allowed to open the hangout app and it displays the contacts for us. After picking contacts, we could able to send message / share text with that particular contact.

check this reference link

To open hangout chat directly without user to pick from the listed apps, below code will help you,

    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("text/plain");
    share.putExtra(Intent.EXTRA_TEXT, "Hi");
    share.setPackage("com.google.android.talk");  // open hangouts app directly
    startActivity(share);

Happy Coding..!! :) :)

Community
  • 1
  • 1
Swaminathan V
  • 4,663
  • 2
  • 22
  • 32