/* ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.android.internal.telephony; import android.app.PendingIntent; import com.android.internal.telephony.SmsRawData; import java.util.List; /** Interface for applications to access the ICC phone book. * *
The following code snippet demonstrates a static method to * retrieve the ISms interface from Android:
*private static ISms getSmsInterface() throws DeadObjectException { IServiceManager sm = ServiceManagerNative.getDefault(); ISms ss; ss = ISms.Stub.asInterface(sm.getService("isms")); return ss; } **/ interface ISms { void synthesizeMessages(String originatingAddress, String scAddress, in List
PendingIntent
is
* broadcast when the message is sucessfully sent, or failed.
* The result code will be Activity.RESULT_OK for success,
* or one of these errors:
* RESULT_ERROR_GENERIC_FAILURE
* RESULT_ERROR_RADIO_OFF
* RESULT_ERROR_NULL_PDU
* For RESULT_ERROR_GENERIC_FAILURE
the sentIntent may include
* the extra "errorCode" containing a radio technology specific value,
* generally only useful for troubleshooting.
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applicaitons,
* which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntent if not NULL this PendingIntent
is
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
*/
void sendData(in String destAddr, in String scAddr, in int destPort,
in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent);
/**
* Send an SMS.
*
* @param smsc the SMSC to send the message through, or NULL for the
* default SMSC
* @param text the body of the message to send
* @param sentIntent if not NULL this PendingIntent
is
* broadcast when the message is sucessfully sent, or failed.
* The result code will be Activity.RESULT_OK for success,
* or one of these errors:
* RESULT_ERROR_GENERIC_FAILURE
* RESULT_ERROR_RADIO_OFF
* RESULT_ERROR_NULL_PDU
* For RESULT_ERROR_GENERIC_FAILURE
the sentIntent may include
* the extra "errorCode" containing a radio technology specific value,
* generally only useful for troubleshooting.
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntent if not NULL this PendingIntent
is
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
*/
void sendText(in String destAddr, in String scAddr, in String text,
in PendingIntent sentIntent, in PendingIntent deliveryIntent);
/**
* Send a multi-part text based SMS.
*
* @param destinationAddress the address to send the message to
* @param scAddress is the service center address or null to use
* the current default SMSC
* @param parts an ArrayList
of strings that, in order,
* comprise the original message
* @param sentIntents if not null, an ArrayList
of
* PendingIntent
s (one for each message part) that is
* broadcast when the corresponding message part has been sent.
* The result code will be Activity.RESULT_OK for success,
* or one of these errors:
* RESULT_ERROR_GENERIC_FAILURE
* RESULT_ERROR_RADIO_OFF
* RESULT_ERROR_NULL_PDU
.
* @param deliveryIntents if not null, an ArrayList
of
* PendingIntent
s (one for each message part) that is
* broadcast when the corresponding message part has been delivered
* to the recipient. The raw pdu of the status report is in the
* extended data ("pdu").
*/
void sendMultipartText(in String destinationAddress, in String scAddress,
in List parts, in List sentIntents,
in List deliveryIntents);
/**
* Enable reception of cell broadcast (SMS-CB) messages with the given
* message identifier. Note that if two different clients enable the same
* message identifier, they must both disable it for the device to stop
* receiving those messages.
*
* @param messageIdentifier Message identifier as specified in TS 23.041
* @return true if successful, false otherwise
*
* @see #disableCellBroadcast(int)
*/
boolean enableCellBroadcast(int messageIdentifier);
/**
* Disable reception of cell broadcast (SMS-CB) messages with the given
* message identifier. Note that if two different clients enable the same
* message identifier, they must both disable it for the device to stop
* receiving those messages.
*
* @param messageIdentifier Message identifier as specified in TS 23.041
* @return true if successful, false otherwise
*
* @see #enableCellBroadcast(int)
*/
boolean disableCellBroadcast(int messageIdentifier);
/**
* Enable reception of cell broadcast (SMS-CB) messages with the given
* message identifier range. Note that if two different clients enable
* a message identifier range, they must both disable it for the device
* to stop receiving those messages.
*
* @param startMessageId first message identifier as specified in TS 23.041
* @param endMessageId last message identifier as specified in TS 23.041
* @return true if successful, false otherwise
*
* @see #disableCellBroadcastRange(int, int)
*/
boolean enableCellBroadcastRange(int startMessageId, int endMessageId);
/**
* Disable reception of cell broadcast (SMS-CB) messages with the given
* message identifier range. Note that if two different clients enable
* a message identifier range, they must both disable it for the device
* to stop receiving those messages.
*
* @param startMessageId first message identifier as specified in TS 23.041
* @param endMessageId last message identifier as specified in TS 23.041
* @return true if successful, false otherwise
*
* @see #enableCellBroadcastRange(int, int)
*/
boolean disableCellBroadcastRange(int startMessageId, int endMessageId);
/**
* Returns the premium SMS send permission for the specified package.
* Requires system permission.
*/
int getPremiumSmsPermission(String packageName);
/**
* Set the SMS send permission for the specified package.
* Requires system permission.
*/
void setPremiumSmsPermission(String packageName, int permission);
}