簡體   English   中英

將彩信發送到不同的Android設備

[英]Sending MMS into different Android devices

我需要發送彩信。 對我的英雄來說,這段代碼很難看,但是可以工作:

Intent sendIntent = new Intent("android.intent.action.SEND_MSG"); 
   sendIntent.putExtra("address", toText); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");

sendIntent.putExtra("sms_body", textMessage); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/jpeg"); 
startActivity(sendIntent);

但是在我看來,在其他設備上它根本不起作用。 我想直接發送到主消息傳遞應用程序而沒有任何選擇(當然,更好的解決方案-直接從我的應用程序發送)。 因為不確定他們是否都能正確處理。 如果有人可以推薦任何第三方庫,我將不勝感激。

您是否嘗試過這樣的事情(更改您的需求並添加圖像等...):

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mmsto:<number>");
intent.putExtra("address", <number>);
intent.putExtra("subject", <subject>);
startActivity(intent);

以上是我能想到的最好的方法,適用於HTC / Nexus / SE(從1.6到2.2)。

您可以嘗試類似的方法。這將啟動所有可以處理此意圖的應用程序。

intent.setAction(Intent.ACTION_SEND);
//In case of multiple file
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, <List of uris>);
intent.putExtra(Intent.EXTRA_STREAM, <singleUri>);
intent.setType("*/*");
startActivity(intent);

從您的應用發送?

在startActivity之前,您可以

intent.setClassName(“您的包名”,“您的類名”);

startActivity(intent);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM