Launch chat with user in MS Teams Android app from my android app

☆樱花仙子☆ 提交于 2021-02-10 07:04:41

问题


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?


回答1:


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. 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)
    }
    
  2. force open chat with user in MS Teams Android app. Same as above, but substitute in Uri https with msteams:

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


来源:https://stackoverflow.com/questions/60788098/launch-chat-with-user-in-ms-teams-android-app-from-my-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!