There are previous discussions here regarding starting a Google Hangout from an intent on Android: start google hangouts in android
How can I start a Google Hangout
So I don't know if this helps anyone else because I was mostly looking to fire off an intent using tasker. If you go into Google+ > Settings > Contacts you can check "Keep contacts up to date" and it will add some new actions to card that appears when you click on a user in android. Then you can use Intent Intercept to read the values coming through. Here's what I got:
ACTION: android.intent.action.VIEW
DATA: content://com.android.contacts/data/5555
TYPE: vnd.android.cursor.item/vnd.googleplus.profile.comm
FLAGS:
FLAG_ACTIVITY_FORWARD_RESULT
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
FLAG_ACTIVITY_PREVIOUS_IS_TOP
1 ACTIVITIES MATCH THIS INTENT:
Hangouts (com.google.android.talk - com.google.android.apps.babel.phone.BabelProfileActionActivity)
I was able to use the top three values to properly open a conversation with that contact. Obviously the number in your data field will change depending on the contact. You can either use the trick with Intent Intercept, or if you have root you can use something like SQLite Debugger to crack open the data table in the contacts database and find rows where the MIMETYPE_ID = 16 and the DATA4 = 10. You'll have to find your out what your RAW_CONTACT_ID is too. Good luck!
Hangout can handle generic share intent.
Here is the code:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, "text to be shared");
activity.startActivity(sendIntent);
try in this way
Below method use to share text to hangout
/**
* Initiate the actions encoded in the specified URI.
*/
public void initiateHangOutUri(Context myContext, String textToShare) {
// Make sure Android client is installed.
if (!isHangOutClientInstalled(myContext)) {
goToMarket(myContext);
return;
}
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textToShare);
sendIntent.setType("text/plain");
sendIntent.setPackage("com.google.android.talk");
context.startActivity(sendIntent);
return;
}
Below method use to check HangOut installed on this device
/**
* Determine whether the HangOut for Android client is installed on this device.
**/
public boolean isHangOutClientInstalled(Context myContext) {
final PackageManager packageManager = context.getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage("com.google.android.talk");
if (intent == null) {
return false;
}
List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
Below method use goto playstore if HangOut not installed
public void goToMarket(Context myContext) {
Uri marketUri = Uri.parse("market://details?id=com.skype.raider");
Intent myIntent = new Intent(Intent.ACTION_VIEW, marketUri);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myContext.startActivity(myIntent);
return;
}
hey i think you try this.
Intent sky = new Intent("android.intent.action.VIEW", Uri.parse("https://talkgadget.google.com/hangouts/extras/talk.google.com/myhangout"));
startActivity(sky);
You just need to give the url of the hangout, but unfortunately google suspended the named hangots, so this url every time changes.
Simple solution is, Query ContactContract.Data for the _id and MIME type.
ContentResolver resolver = context.getContentResolver();
cursor = resolver.query(
ContactsContract.Data.CONTENT_URI,
null, null, null,
ContactsContract.Contacts.DISPLAY_NAME);
//Now read data from cursor like
while (cursor.moveToNext()) {
long _id = cursor.getLong(cursor.getColumnIndex(ContactsContract.Data._ID));
String displayName = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
String mimeType = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.MIMETYPE));
Log.d("Data", _id+ " "+ displayName + " " + mimeType );
}
The output will be like the following
12561 Allen vnd.android.cursor.item/vnd.googleplus.profile.comm
12562 Allen vnd.android.cursor.item/vnd.googleplus.profile.comm
12564 Allen vnd.android.cursor.item/vnd.googleplus.profile
Now save in DB or somewhere else only those _Ids whose MIME type is vnd.android.cursor.item/vnd.googleplus.profile.comm
And then you initiate hangout call/message with those contacts like this way
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
// the _ids you save goes here at the end of /data/12562
intent.setDataAndType(Uri.parse("content://com.android.contacts/data/_id"),
"vnd.android.cursor.item/vnd.googleplus.profile.comm");
intent.setPackage("com.google.android.talk");
startActivity(intent);
For the above code to work you must have to check "Keep contacts up to date" in the Google+ App > Settings> Contacts.