Reputation: 241
In my application, I'd like to provide a Chat button. In the context of a specific contact, the user is shown a list of the contact methods available. For example, it might list a Google Talk ID and an AIM ID. The user can click on either ID and it should launch the appropriate application that handles the selected chat protocol (if one is installed). Given that I have the protocol and the ID (e.g., PROTOCOL_GOOGLE_TALK and "JohnDoeGtalk"), how can I create an intent that does that?
Thanks.
Upvotes: 1
Views: 1424
Reputation: 9821
Have you tried adding @gmail.com in your URI?
The following approach, taken from here, works for me; it opens a new chat with the contact, using the Google Talk app. Using HTC Desire running Froyo. Code:
Uri imUri = new Uri.Builder().scheme("imto").authority("gtalk").appendPath("[email protected]").build();
Intent intent = new Intent(Intent.ACTION_SENDTO, imUri);
startActivity(intent);
Upvotes: 1
Reputation: 1007340
An ACTION_SENDTO
Intent
with a Uri
whose scheme is imto://...
may work. See this issue and comment #2 for the apparently-valid syntax. Note that I have not tried this, and this issue is from quite some time ago.
Upvotes: 0