简体   繁体   English

在使用意图选择器时,如何知道用户选择了哪个应用程序?

[英]How to know which application the user chose when using an intent chooser?

I'm using an intent chooser to invite friends : 我正在使用意图选择器邀请朋友:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, Resources.getString("InvitationSubject", getBaseContext()));

String body = Resources.getString("InvitationBody", getBaseContext()) + Local.User.FirstName;

intent.putExtra(Intent.EXTRA_TEXT, body);

startActivity(Intent.createChooser(intent, "Invite friends"));

Is there a way to know which app the user selected in the chooser ? 有没有办法知道用户在选择器中选择了哪个应用程序?

As far as I know, there is no direct way to gather such information. 据我所知,没有直接的方法来收集此类信息。 What would you need it for? 您需要什么? Imho the android intent system was designed so you, as an app developer, don't have to worry about what app the user chose to handle your intent. Imho设计了android intent系统,因此,作为应用程序开发人员,您不必担心用户选择了哪种应用程序来处理您的意图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何确定用户使用默认的startActivity(intent)选择器选择的应用程序? - How to determine which app the user selects with the default startActivity(intent) chooser? 如何知道用户正在使用的应用程序名称? - How to know the application name which the user was using? 如何使用意图选择器处理主键以重定向应用程序? - How to handle home key to redirect application using intent chooser? 用户取消意图选择器时会发生事件吗? - Is there an event when user cancels intent chooser? 知道用户是否从选择器中选择了意图动作的方法 - way to know if the user has chosen the intent action from chooser or not 我如何知道用户在android中的共享意图中选择了哪个应用程序 - How do I know which application is selected by user in Sharing Intent in android 使用Intent Chooser时视频会自动恢复 - Video automatically resumed when using Intent Chooser 如何通过意图共享知道哪个应用程序共享 - How to know which application is share through intent share Android如何根据选择器意图中的用户操作请求权限 - Android how to request permission based on user action in chooser intent 使用隐式意图时,活动没有出现在选择器对话框中 - Activity not appearing on Chooser dialog when using Implicit Intent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM