Android phone-related operations

Source: Internet
Author: User

1. Implementation of telephone Dialers

Permission

 
<Uses-Permission Android: Name = "android. Permission. call_phone"/>

JavaCode:

 
Intent intent = new intent (intent. action_call, Uri. parse ("Tel:" + edittext. gettext (); dialeraction. This. startactivity (intent );
 
2. Implementation of SMS sending
 
Permission
 
 
    

 

activity code:

 string mobile = mobileview. gettext (). tostring (); string content = contentview. gettext (). tostring (); smsmanager = smsmanager. getdefault (); pendingintent sentintent = pendingintent. getbroadcast (context, 0, new intent (), 0); If (content. length ()> 70) {// if the number of words exceeds 70, you need to split it into multiple SMS sending lists 
   
     msgs = smsmanager. dividemessage (content); For (string MSG: MSGs) {smsmanager. sendtextmessage (mobile, null, MSG, sentintent, null); // The last two parameters are the broadcast intent sent by the SMS, the last parameter is the broadcast intent that the recipient has received the SMS.} else {smsmanager. sendtextmessage (mobile, null, content, sentintent, null);} toast. maketext (smssender. this, "message sent successfully", toast. length_long ). show (); 
   

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.