Android.telephony.SmsManager SMS Notes

Source: Internet
Author: User

Several ways to send SMS to Android

http://www.oschina.net/question/163910_27409

<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
Package Com.union.matchfighter;import Android.app.pendingintent;import Android.telephony.smsmanager;public class PSMS {/***  * Send message   */public void SendMessage (string number, string scaddress, string content, Pendingintent Sentin Tent, Pendingintent deliveryintent) {     Smsmanager SMS = Smsmanager.getdefault ();    Sms.sendtextmessage (number, scaddress, content, sentintent, deliveryintent);} /*** * Send SMS  */public void SendMessage (string number, string content) {  System.out.println ("1111 SendMessage ");    Smsmanager SMS = Smsmanager.getdefault ();    Sms.sendtextmessage (number, NULL, content, NULL, NULL);    System.out.println ("1111 SendMessage");}  Static PSMS _instance;p ublic static PSMS getinstance () {if (_instance = = null)  _instance = new PSMS (); return _instance ;}  /* This paragraph needs to be placed on the main UI public void Psms_sendmessage (string number, string content  ) {     psms.getinstance (). SendMessage (number, content);} */ }

Using unityengine;using System.collections;public class PSMS {//<summary>///Send SMS//&LT;/SUMMARY&GT    ; <param name= "number" ></param>//<param name= "content" ></param> public void SendMessage    (string number, string content)        {if (Application.platform = = runtimeplatform.android) {sendmessageandroid (number, content);        } else {Debug.Log (Application.platform + ": Is not fix"); }} public void Sendmessageandroid (string number, string content) {Androidjavaclass JC = new Androidjavac        Lass ("Com.unity3d.player.UnityPlayer"); Androidjavaobject Jo = JC.        Getstatic<androidjavaobject> ("currentactivity"); Jo.    Call ("Psms_sendmessage", number, content);    } static PSMS _instance;            public static PSMS instance {get {if (_instance = = null) _instance = new PSMS ();        return _instance; }    } }

Android.telephony.SmsManager SMS Notes

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.