Android, iOS open the mobile QQ chat interface with the specified user

In the browser, you can open QQ through JS code and pop up the chat interface, which is generally used as a customer service QQ. On the mobile terminal, Tencent does not seem to have announced a similar API, but it can use the schema mode to start mobile QQ.

//Take opening WeChat as an example, the premise needs to know the package name of the open application. Generally, the package name of a released version of the application will not be easily changed. However, you must pay attention to opening QQ. After all, the release version of QQ is no less than 4 version.

Intent intent = getPackageManager().getLaunchIntentForPackage("com.tencent.mm"); 
startActivity(intent); 


The following is the specific code:

Android:

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

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

浏览器:
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=123456&site=qq&menu=yes">click here</a>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327094372&siteId=291194637