Android,iOS打開手機QQ與指定用戶聊天界面

在瀏覽器中能夠經過JS代碼打開QQ並彈出聊天界面,通常做爲客服QQ使用。而在移動端騰訊貌似沒有公佈提供相似API,可是卻能夠使用schema模式來啓動手機QQ。html

如下爲具體代碼:java

Android:web

[java]  view plain  copy
  1. String url="mqqwpa://im/chat?chat_type=wpa&uin=123456";  
  2. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));  


iOS:

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

瀏覽器:

[html]  view plain  copy
  1. <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=123456&site=qq&menu=yes">click here</a>  
一鍵加入qq羣操做
http://qun.qq.com/join.html
相關文章
相關標籤/搜索