send voice message to another contact number

こ雲淡風輕ζ 提交于 2019-12-11 10:57:48

问题


I have made a program, in which I am sending some text to pre defined contact number, but now I also want to send voice message to that number please let me know how can I do this?

To send text SMS I am using below code:-

            String phoneNumber = "XXXX9";
            String message = editLocation.getText().toString();
            SmsManager smsManager = SmsManager.getDefault();
            smsManager.sendTextMessage(phoneNumber, null, message, null, null);
            Toast.makeText(getApplicationContext(), 
            "Message Sent!", Toast.LENGTH_LONG).show();

回答1:


Refer this link. In this link there is an explaination on how to send images via MMS. you can just replace the image file with the Audio File. you can find the code to send voice message in the Comments of the above link.




回答2:


Try something like this

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("sms_body", "some text");     
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url)); // url would point to mp3 file
sendIntent.setType("audio/mp3"); 


来源:https://stackoverflow.com/questions/14036327/send-voice-message-to-another-contact-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!