2010-01-29 22 views
0

我需要發送彩信。進入我的英雄這段代碼看起來很醜,但起作用:將彩信發送到不同的Android設備

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

但是在我看來,在其他設備上它根本不起作用。 我想直接發送到主消息應用程序沒有任何選擇(當然更好的解決方案 - 直接從我的應用程序)。因爲不確定所有人都會妥善處理。 如果有人可以推薦任何第三方庫,我會很滿意。

回答

0

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

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。

0

從您的應用程序發送?

startActivity之前,你可以

intent.setClassName( 「你的包名」, 「你的類名」);

startActivity(intent);