|
本帖最后由 linyan 于 2020-1-15 19:20 编辑
打开微信时发生错误,不知是何原因引起的。
private void button1_Press(object sender, EventArgs e)
{
AndroidCodeProvider provider = new AndroidCodeProvider();
provider.Imports.Add("android.content.Intent");
provider.Imports.Add("android.content.ComponentName");
//打开不同的应用
//微信 com.tencent.mm com.tencent.mm.ui.LauncherUI
//QQ com.tencent.mobileqq com.tencent.mobileqq.activity.HomeActivity
provider.MethodBody = @"
Intent intent = new Intent();
ComponentName cmp = new ComponentName(""com.tencent.mm"",""com.tencent.mm.ui.LauncherUI"");
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
activity.startActivity(intent);";
this.androidCodeCompiler1.Run(provider, (obj, args) =>
{
if (args.isError == true)
MessageBox.Show(args.error);
else
Toast("打开微信成功");
});
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|