欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Android,iOS打开手机QQ与指定用户聊天界面

shiping1 的头像

在浏览器中可以通过JS代码打开QQ并弹出聊天界面,一般作为客服QQ使用。而在移动端腾讯貌似没有公布提供类似API,但是却可以使用schema模式来启动手机QQ。

以下为具体代码:

Android:

  1. String url="mqqwpa://im/chat?chat_type=wpa&uin=501863587";  
  2. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));  

 

iOS:
  1. UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];  
  2. NSURL *url = [NSURL URLWithString:@"mqq://im/chat?chat_type=wpa&uin=501863587&version=1&src_type=web"];  
  3. NSURLRequest *request = [NSURLRequest requestWithURL:url];  
  4. webView.delegate = self;  
  5. [webView loadRequest:request];  
  6. [self.view addSubview:webView];  

浏览器:
  1. <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=592333407&site=qq&menu=yes">click here</a> 
来自 http://blog.csdn.net/qduningning/article/details/40587099
普通分类: