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.
Asked
Active
Viewed 1,151 times
-1
-
use intent to open hangout chat from android. – Swaminathan V Dec 15 '15 at 11:23
-
@RaguSwaminathan i know how to just open hangouts in new activity , my purpose is to open it on specific chat - with the user name/id that i already have – moshe puptic Dec 15 '15 at 11:30
-
username / id ?? are you reffering to the email account configured in hangout or something else like mobile number. – Swaminathan V Dec 15 '15 at 12:01
-
@RaguSwaminathan yeah i meant to open the relevant chat by email account, sorry i didnt mention clearly – moshe puptic Dec 15 '15 at 15:08
2 Answers
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