【发布时间】:2014-03-27 00:48:19
【问题描述】:
我有一个可以通过调用 startActivity 来发送正常意图的应用:
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("audio/*");
sharingIntent.setPackage("com.whatsapp");
sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.fromFile(filepath));
startActivity(sharingIntent);
但我希望我的应用程序出现在 whatsapp 附加菜单(特别是音频项)上,例如这个相关的讨论示例:Returning an Image to whatsapp
所以,我使用下面的代码,我的应用程序显示在菜单上,但是当我执行共享步骤时,我收到了 whatsapp“共享失败,请重试”错误消息。其他类似的应用程序执行这些步骤,最后一步显示 Whatsapp Recorder 对话框以在聊天中应用声音。
在第二个功能(whatsapp 内部意图过滤器共享)上,我使用相同的意图,但这样做:
setResult(RESULT_OK, buildSoundShareIntent(soundId));
finish();
而不是startActivity
是否有一些我找不到的特定和隐藏的东西?
【问题讨论】:
标签: android audio android-intent intentfilter whatsapp