其實(shí)很簡(jiǎn)單伴鳖,打開(kāi)該鏈接:http://qun.qq.com/join.html
Paste_Image.png
選擇需要添加的QQ群號(hào)器予,會(huì)自動(dòng)生成添加QQ群的代碼白指,主要他會(huì)生成一個(gè)key戏仓。
public boolean joinQQGroup(String key)
{
Intent intent = new Intent();
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key));
// 此Flag可根據(jù)具體產(chǎn)品需要自定義菱肖,如設(shè)置客冈,則在加群界面按返回,返回手Q主界面稳强,不設(shè)置场仲,按返回會(huì)返回到呼起產(chǎn)品界面
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
startActivity(intent);
return true;
} catch (Exception e) {
// 未安裝手Q或安裝的版本不支持
return false; }
}
獲取網(wǎng)站生成的鏈接的key作為參數(shù)傳到j(luò)oinQQGroup(String key)方法就可以實(shí)現(xiàn)一鍵加群啦~~~