从我的 Android 应用程序启动与 MS Teams Android 应用程序中的用户聊天 [英] Launch chat with user in MS Teams Android app from my android app

查看:45
本文介绍了从我的 Android 应用程序启动与 MS Teams Android 应用程序中的用户聊天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Android 应用,点击按钮应该会启动 Microsoft Teams Android 应用并打开与预定义用户的聊天.

I have an Android app, where a tap on a button should launch Microsoft Teams Android app and open a chat with a pre-defined user.

是否可以做,如果可以,怎么做?

Is it possible to do and if yes - how?

推荐答案

如果您知道用户在 MS Teams 中注册的电子邮件(例如:username@email.com),您可以使用以下两个选项之一直接打开与他/她的聊天:

If you know user's E-Mail with which he/she is registered in MS Teams (ex: username@email.com), you can directly open chat with him/her using one of two options:

  1. 向用户显示一个选择表,可选择在 MS Teams Android 应用程序或网络浏览器之一中打开聊天:

  1. show user a chooser sheet with a choice to open chat in MS Teams Android app or one of web browsers:

val sendIntent = Intent(Intent.ACTION_VIEW,
    Uri.parse("https://teams.microsoft.com/l/chat/0/0?users=username@email.com"))

if (sendIntent.resolveActivity(packageManager) != null) {
    startActivity(sendIntent)
}

  • 在 MS Teams Android 应用中强制与用户打开聊天.同上,但在 Uri https 中替换为 msteams:

    Uri.parse("msteams://teams.microsoft.com/l/chat/0/0?users=username@email.com")
    

    这篇关于从我的 Android 应用程序启动与 MS Teams Android 应用程序中的用户聊天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆