android - Attachment not working with intent -


i have tried 2 ways attachment sms 1 hardcoded (the file 100% exists) have checked many times.:

intent sms = new intent(intent.action_sendto,                 uri.parse("smsto:" + number));         sms.putextra("sms_body", smsbody);         sms.putextra(intent.extra_stream, "file:///storage/sdcard/pictures/imageapp/img_20160107_133123.jpg");         startactivity(sms); 

the other:

        uri picture = uri.fromfile(picturefile);          string smsbody = "this sms!";          intent sms = new intent(intent.action_sendto,                 uri.parse("smsto:" + number));         sms.putextra("sms_body", smsbody);         sms.putextra(intent.extra_stream, picturefile);         startactivity(sms); 

the picture variable in debug returns like:

   file:///storage/sdcard/pictures/imageapp/img_20160107_144801.jpg 

this exists, i've checked adm.

what problem? why picture not being transferred attachment? thanks.

try adding type

sms.settype("application/image"); 

or

sms.settype("image/jpeg");  

this should work


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -