Class SmsManager


  • public class SmsManager
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static SmsManager getDefault()
      Get the default SmsManager.
      void registerSmsReceiver​(SmsReceiver receiver)
      Registers a receiver to listen for incoming text sms messages
      void registerSmsReceiver​(SmsReceiver receiver, int port)
      Registers a receiver to listen for incoming sms messages
      void sendDataMessage​(java.lang.String destinationAddress, java.lang.String scAddress, int port, byte[] data)
      Send a data based SMS to a specific application port.
      void sendTextMessage​(java.lang.String destinationAddress, java.lang.String scAddress, java.lang.String text)
      Send a text based SMS.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDefault

        public static SmsManager getDefault()
        Get the default SmsManager.
      • registerSmsReceiver

        public void registerSmsReceiver​(SmsReceiver receiver,
                                        int port)
        Registers a receiver to listen for incoming sms messages
        Parameters:
        receiver - the receiver that will handle incoming sms messages or null to stop listening incoming messages
        port - the port to listen for incoming sms messages - required for data sms messages, pass -1 to listen on default port for text messages
      • registerSmsReceiver

        public void registerSmsReceiver​(SmsReceiver receiver)
        Registers a receiver to listen for incoming text sms messages
        Parameters:
        receiver - the receiver that will handle incoming text sms messages or null to stop listening incoming messages
      • sendTextMessage

        public void sendTextMessage​(java.lang.String destinationAddress,
                                    java.lang.String scAddress,
                                    java.lang.String text)
        Send a text based SMS.
        Parameters:
        destinationAddress - the address to send the message to
        scAddress - the service center address or null to use the current default SMSC
        text - the body of the message to send
      • sendDataMessage

        public void sendDataMessage​(java.lang.String destinationAddress,
                                    java.lang.String scAddress,
                                    int port,
                                    byte[] data)
        Send a data based SMS to a specific application port.
        Parameters:
        destinationAddress - the address to send the message to
        scAddress - the service center address or null to use the current default SMSC
        port - the port to deliver the message to
        data - the body of the message to send