简体   繁体   中英

send mms without user interaction in android

 Intent intent = new Intent(Intent.ACTION_SENDTO);
 intent.putExtra("address", "12134567899");
 intent.putExtra("sms_body", "See attached picture");


 intent.putExtra(Intent.EXTRA_STREAM,
 Uri.parse("file:///sdcard/DCIM/Camera/2011-09-09 12.47.29.jpg"));
 intent.setType("image/png");


 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

 startActivity(intent);

i try code like this. if intent start mms compose ui was coming how can i overcome and send automatically

First of all. good luck. Since MMS isn't supported by the android sdk, you have 2 options:

  1. download the android mms aplication and try to understand what's going on there.

  2. follow this link: http://androidbridge.blogspot.com/2011/03/how-to-send-mms-programmatically-in.html

only thing I found working at the moment....

This feature was designed as a safety feature in Android, please do not try to bypass it. It's there for a reason.

If you absolutly must, have you tried running it on a rooted device? It allows greater access.

try this its worked with me . use Uri.fromFile instead of Uri.parse

File f=new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/DCIM/Camera/"+img_name);
Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("", ""); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
sendIntent.setType("image/png");  
startActivity(sendIntent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM