ボタンのクリックで MMS を送信する必要があるアプリケーションの要件があります。ボタンをクリックすると、電子メールまたはメッセージングのいずれかのアクションを実行するアプリケーションを選択するよう求められます。メッセージでデフォルトで開くようにしたい。いろいろ調べましたが、答えが得られませんでした。以下に、コードを投稿しています。
public class MMSActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button mms = (Button)findViewById(R.id.mms);
mms.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
sendMMS();
}
});
}
public void sendMMS() {
Intent in = new Intent(Intent.ACTION_SEND);
in.putExtra("sms_body", "some text");
in.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(Environment.getExternalStorageDirectory()
.getAbsolutePath().toString()+"/diplomat/ALEXANDRA-1339242345022.jpg")));
in.setType("image/jpeg");
startActivity(in);
Log.d("MMS", "SendMMS called");
}
}
クラスを android.telephony.SmsMessage として設定しようとしましたが、うまくいきませんでした。