start google hangouts in android

我与影子孤独终老i 提交于 2019-12-30 06:47:12

问题


I want to start a new hangout conversation with given people, but I can't find any code for it. Is there any easy solution to do this? I tryed to make skype call, and it worked easyly with an intent.

Here is the skype code:

                Intent sky = new Intent("android.intent.action.VIEW");
                sky.setData(Uri.parse("skype:" + nickname));
                startActivity(sky);

I want something similar to this. (Or with skype how can I make a conference call? )


回答1:


There is currently no way to create a Google+ hangout on an android device using an intent or any other API.

This would be a pretty cool feature, though. If you request it, they might add it.




回答2:


I think I found the solution, it's quite simple, here is the code:

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. :(




回答3:


       public static void sendHangout(Context ctx, String message, String urlShare, String imgPath){
            Intent hangouts = new Intent(Intent.ACTION_SEND);
                if(!Utilities.isNullorEmpty(imgPath)){
                    String file = (String)imgPath.subSequence(0, imgPath.lastIndexOf("/") + 1) + message.replace(" ", "").replace(":", "").replace(".", "")
                            .replace("/", "") + ".jpeg";
                    Utilities.copyFile(imgPath, file);
                    hangouts.setType("image/*");
                    hangouts.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///" + file));
                }
            hangouts.setPackage("com.google.android.talk");
            hangouts.setType("text/plain");
            hangouts.putExtra(Intent.EXTRA_TEXT, message + ": \n" + urlShare);
            ctx.startActivity(Intent.createChooser(hangouts, "Hangouts is not installed."));    
}

I hope help you.




回答4:


Intent i = context.getPackageManager().getLaunchIntentForPackage("com.google.android.talk");
context.startActivity(i);


来源:https://stackoverflow.com/questions/11127051/start-google-hangouts-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!