2014-02-10 42 views
2

当我使用此代码发送mms给特定用户时,它显示我弹出以通过gmail,whatsapp,gtalk,消息等发送它。但在我的情况下,我只是想将该图像作为mms发送到特定的数字我将在地址栏中定义,而不显示任何弹出窗口可以告诉我如何做到这一点?我搜索了这个,并找到很多东西。如何发送彩信而不提示通过gmail,whatsapp或其他方式发送彩信?

这里是我的代码* 强大的文本 *

public void sendData(int num){ 
    String fileString = "..."; //put the location of the file here 
    Intent mmsIntent = new Intent(Intent.ACTION_SEND); 
    mmsIntent.putExtra("sms_body", "text"); 
    mmsIntent.putExtra("address", num); 
    mmsIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(fileString))); 
    msIntent.setType("image/jpeg"); 
    startActivity(Intent.createChooser(mmsIntent, "Send")); 

} 
+0

也许这可以帮助:http://stackoverflow.com/a/5417708/1809221 –

+0

嘿感谢您的答复。我会尝试这样可以告诉你它是否有效 – Ricky

+0

@Manu Zi com.android.mms.ui.ComposeMessageActivity是android中的默认包,或者我想创建它。 – Ricky

回答

2

使用的意图(像你这样)是首选方式,因为它很容易实现,并让用户选择自己喜欢的应用进行的任务发送彩信。

这就是说,你仍然可以实现自己的操作,并通过编写和发送适当的HTTP请求以编程方式从您的应用程序发送彩信。

以下的答案将为您提供您所需要的所有信息:How to send image via MMS in Android?

+0

是否有一些替代这个职位,你有建议。 – Ricky

+0

检查这也是:http://stackoverflow.com/questions/17362191/how-to-send-mms-without-intent-programatically和https://github.com/android/platform_packages_apps_mms – fiddler

+0

感谢提琴手为您的宝贵答复。 :-) – Ricky