Android 安卓奇怪的意图行为。动作\u发送
我正在使用一段代码让用户能够通过不同的应用程序共享我的应用程序的音乐,如Android 安卓奇怪的意图行为。动作\u发送,android,android-intent,Android,Android Intent,我正在使用一段代码让用户能够通过不同的应用程序共享我的应用程序的音乐,如Viber,Whatsapp,Gmail和 Uri theUri = Uri.parse(CopyAssets( SHARE)); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("audio/*"); intent.putExtra(Intent.EXTRA_STREAM, theU
Viber
,Whatsapp
,Gmail
和
Uri theUri = Uri.parse(CopyAssets(
SHARE));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("audio/*");
intent.putExtra(Intent.EXTRA_STREAM, theUri);
startActivity(intent);
但它并没有列出这些应用的完整列表。例如,我在列表中看不到
Viber
,但WhatsApp
在列表中。我的代码有什么问题?您的代码没有问题。你在告诉Android我想要所有支持MIME类型“audio/*”的应用程序
由其他应用程序来告诉Android“我支持这种类型”。如果他们这样做了,他们会出现(就像WhatsApp那样),但是如果他们没有出现(在Viber的情况下),那么他们就不会出现在列表中
看看这里viber可能没有响应发送音频的意图。但我可以看到其他应用程序,使您能够通过viber共享音乐。您可能希望使用
setDataAndType
来同时使用类型和uri,而不是在额外的应用程序中使用uri