iphone代码:
[objc] view plain copy - (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", @"xxx",@"xxx"]; NSURL *url = [NSURL URLWithString:urlStr]; if([[UIapplication sharedApplication] canOpenURL:url]){ [[UIApplication sharedApplication] openURL:url]; return YES; } else return NO; }Android代码:
[java] view%20plain copy /**************** * * 发起添加群流程。QQ群的 key 为: -xxx * 调用 joinQQGroup(-xxx) 即可发起手Q客户端申请加群 * * @param key 由官网生成的key * @return 返回true表示呼起手Q成功,返回fals表示呼起失败 ******************/ 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可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) try { startActivity(intent); return true; } catch (Exception e) { // 未安装手Q或安装的版本不支持 return false; } }网页代码:
[html] view%20plain copy <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=xxx"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="xx用户群" title="xx用户群"></a>参考:http://qun.qq.com/join.html
新闻热点
疑难解答