通过Facebook,电子邮件和短信/彩信分享音频文件(.MP3) [英] Share audio file (.mp3) via Facebook, email, and SMS/MMS
问题描述
我有一个音频文件(MP3播放),以及与之相关的一些信息。我想与Facebook,电子邮件,短信/彩信,分享等。
I have an audio file (.mp3) and some information related to it. I want to share with Facebook, E-mail, SMS/MMS, etc..
我所做的是:当用户点击分享按钮,它会弹出所有支持的应用程序可以处理这个意图的列表。但是,这并不表明Facebook和SMS / MMS选项。
What I have done is: when user clicks on the share button, it pops up list of all supported applications that can handle this Intent. But this does not show Facebook and SMS/MMS options.
下面是我的code ..
Here is my code..
public void shareWithFriends(int resId)
{
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("audio/mp3");
share.putExtra(Intent.EXTRA_SUBJECT,"Ringtone File : "+ getResources().getResourceEntryName(resId)+".mp3");
share.putExtra(Intent.EXTRA_TEXT,"Ringtone File : "+getResources().getResourceEntryName(resId)+".mp3");
share.putExtra(Intent.EXTRA_STREAM,Uri.parse("android.resource://com.my.android.soundfiles/"+resId));
share.putExtra("sms_body","Ringtone File : "+ getResources().getResourceEntryName(resId)+".mp3");
startActivity(Intent.createChooser(share, "Share Sound File"));
}
下面是一些结果:
-
当我使用MIME类型
音频/ MP3
,只有电子邮件选项弹出。没有Facebook和SMS / MMS份额。
When I use MIME type
audio/mp3
, only the email options pops up. No Facebook and SMS/MMS share.
当我使用MIME类型 * / *
,电子邮件和短信的选项弹出。没有Facebook的选项是存在的。
When I use MIME type */*
, Email and SMS options pops up. No Facebook option is there.
这是有趣的是,当我点击了短信选项,仅显示文本。我没有看到附加任何MP3文件(同样的事情发生在 WhatsApp的的(因为我有 WhatsApp的的安装在我的手机)。然而,当我点击任何邮件应用程序(例如,Gmail或Yahoo邮箱),它为我连接MP3文件。
Here it is interesting to note that when I click on the SMS option, only text appears. I don't see any MP3 file attached (the same thing happens in Whatsapp (as I have Whatsapp installed on my phone). However, when I click on any mail application (for example, Gmail or Yahoo mail) it shows me the MP3 file attached.
我在哪里去了?
推荐答案
目前是Facebook的任何选项,但您可以用蓝牙共享电子邮件和彩信。这是我的code。看看,如果它可以帮助你:
There is no option for Facebook, but you can share email and MMS with Bluetooth. Here is my code. Take a look if it helps you:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("audio/*");
share.putExtra(Intent.EXTRA_STREAM,Uri.parse("file:///"+mypath));
startActivity(Intent.createChooser(share, "Share Sound File"));
break;
下面我的路径是在 SD卡中的声音文件的路径。
Here my path is the path of the sound file on the SD card.
这篇关于通过Facebook,电子邮件和短信/彩信分享音频文件(.MP3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!