與up主交流(up主建立的QQ群)
網(wǎng)頁代碼:
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=ML_LoANQYzDdBrqMV9NaGRQyc1rQ29Wb&jump_from=webapi&authKey=01oiB8YMkdvW8FxLg64/bar1XCcUy1QAQ6EnR+jBldQAKoElMuKFLsU8t6RZYgfC"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="莫柯游戲交流群一" title="莫柯游戲交流群一"></a>
iPhone代碼:
- (BOOL)joinGroup:(NSString *)groupUin key:(NSString *)key{
NSString *urlStr = [NSString stringWithFormat:@"mqqapi://card/show_pslcard?src_type=internal&version=1&uin=%@&key=%@&card_type=group&source=external&jump_from=webapi", @"744526358",@"a414c57d11b4f390d8ea1e657cff0afee103b4d93a16111a9b78728e72e2634e"];
NSURL *url = [NSURL URLWithString:urlStr];
if([[UIApplication sharedApplication] canOpenURL:url]){
[[UIApplication sharedApplication] openURL:url];
return YES;
}
else return NO;
}
Android代碼:
/****************
*
* 發(fā)起添加群流程。群號(hào):莫柯游戲交流群一(744526358) 的 key 為: kZwVKkfUVTxtIw2UFLmxn9kKKsryAZ2R
* 調(diào)用 joinQQGroup(kZwVKkfUVTxtIw2UFLmxn9kKKsryAZ2R) 即可發(fā)起手Q客戶端申請(qǐng)加群 莫柯游戲交流群一(744526358)
*
* @param key 由官網(wǎng)生成的key
* @return 返回true表示呼起手Q成功,返回false表示呼起失敗
******************/
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%26jump_from%3Dwebapi%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;
? ? }
}
