本文介绍了通过Facebook,电子邮件和短信/彩信共享音频文件(.mp3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个音频文件(.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和短信/彩信选项。

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.

这是我的代码..

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"));
}

以下是一些结果:


  1. 当我使用MIME类型 audio / mp3 时,只会弹出电子邮件选项。没有Facebook和短信/彩信共享。

  1. 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的选择,但您可以使用蓝牙共享电子邮件和彩信,这是我的代码,看看如果它有助于您:

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;

这里我的路径是。

这篇关于通过Facebook,电子邮件和短信/彩信共享音频文件(.mp3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 06:56