uniapp唤起移动QQ聊天

let qq = '123456'
//安卓端
if (plus.os.name == "Android") {
var main = plus.android.runtimeMainActivity();
var Intent = plus.android.importClass('android.content.Intent');
var Uri = plus.android.importClass('android.net.Uri');
var intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin="+ qq));
main.startActivity(intent);
}
//IOS端
if (plus.os.name == "iOS") {
plus.runtime.launchApplication({ action: "mqq://im/chat? chat_type=wpa&uin="+qq +"&version=1&src_type=web" }, function(e) {
plus.nativeUI.confirm("检查到您未安装qq,请先到appstore搜索下载?", function(i) {

if (i.index == 0) { iosAppstore("itunes.apple.com/cn/app/mqq/"); } }); });
}

点击查看代码
let qq = '123456'
	
//安卓端
if (plus.os.name == "Android") {
	var main = plus.android.runtimeMainActivity();  
 	var Intent = plus.android.importClass('android.content.Intent');  
   	var Uri = plus.android.importClass('android.net.Uri');  
  	var intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin="+ qq));  
      main.startActivity(intent);
	 }
	
//IOS端	 
if (plus.os.name == "iOS") {
     plus.runtime.launchApplication({ action: "mqq://im/chat?chat_type=wpa&uin="+qq +"&version=1&src_type=web" }, function(e) { 
plus.nativeUI.confirm("检查到您未安装qq,请先到appstore搜索下载?", function(i) { 

      if (i.index == 0) { iosAppstore("itunes.apple.com/cn/app/mqq/");} 
     });
  }); 
}
posted @ 2021-12-25 16:19  蓦然JL  阅读(583)  评论(0编辑  收藏  举报
访问主页
关注我
关注微博
私信我
返回顶部