public class CellBroadcastMessage extends Object implements Parcelable
SmsCbMessage
. This is Parcelable so that
decoded broadcast message objects can be passed between running Services.
New broadcasts are received by the CellBroadcastReceiver app, which exports
the database of previously received broadcasts at "content://cellbroadcasts/".
The "android.permission.READ_CELL_BROADCASTS" permission is required to read
from the ContentProvider, and writes to the database are not allowed.
Use createFromCursor(android.database.Cursor)
to create CellBroadcastMessage objects from rows
in the database cursor returned by the ContentProvider.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<CellBroadcastMessage> |
CREATOR |
static String |
SMS_CB_MESSAGE_EXTRA
Identifier for getExtra() when adding this object to an Intent.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
CellBroadcastMessage(SmsCbMessage message) |
Modifier and Type | Method and Description |
---|---|
static CellBroadcastMessage |
createFromCursor(Cursor cursor)
Create a CellBroadcastMessage from a row in the database.
|
int |
describeContents()
Parcelable: no special flags.
|
int |
getCmasMessageClass()
Return the CMAS message class.
|
SmsCbCmasInfo |
getCmasWarningInfo() |
ContentValues |
getContentValues()
Return a ContentValues object for insertion into the database.
|
String |
getDateString(Context context)
Return the abbreviated date string for the message delivery time.
|
long |
getDeliveryTime() |
SmsCbEtwsInfo |
getEtwsWarningInfo() |
String |
getLanguageCode() |
String |
getMessageBody() |
int |
getSerialNumber() |
int |
getServiceCategory() |
String |
getSpokenDateString(Context context)
Return the date string for the message delivery time, suitable for text-to-speech.
|
int |
getSubId()
get Subscription information
|
boolean |
isCmasMessage()
Return whether the broadcast is a CMAS emergency message type.
|
boolean |
isEmergencyAlertMessage()
Returns whether the broadcast is an emergency (PWS) message type,
including test messages and AMBER alerts.
|
boolean |
isEtwsEmergencyUserAlert()
Return whether the broadcast is an ETWS emergency user alert.
|
boolean |
isEtwsMessage()
Return whether the broadcast is an ETWS emergency message type.
|
boolean |
isEtwsPopupAlert()
Return whether the broadcast is an ETWS popup alert.
|
boolean |
isEtwsTestMessage()
Return whether the broadcast is an ETWS test message.
|
boolean |
isPublicAlertMessage()
Return whether the broadcast is an emergency (PWS) message type.
|
boolean |
isRead() |
void |
setIsRead(boolean isRead)
Set or clear the "read message" flag.
|
void |
setSubId(int subId)
set Subscription information
|
void |
writeToParcel(Parcel out,
int flags)
Flatten this object in to a Parcel.
|
public static final String SMS_CB_MESSAGE_EXTRA
public static final Parcelable.Creator<CellBroadcastMessage> CREATOR
public CellBroadcastMessage(SmsCbMessage message)
public void setSubId(int subId)
public int getSubId()
public int describeContents()
describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel out, int flags)
Parcelable
writeToParcel
in interface Parcelable
out
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public static CellBroadcastMessage createFromCursor(Cursor cursor)
cursor
- an open SQLite cursor pointing to the row to readIllegalArgumentException
- if one of the required columns is missingpublic ContentValues getContentValues()
public void setIsRead(boolean isRead)
isRead
- true if the message has been read; false if notpublic String getLanguageCode()
public int getServiceCategory()
public long getDeliveryTime()
public String getMessageBody()
public boolean isRead()
public int getSerialNumber()
public SmsCbCmasInfo getCmasWarningInfo()
public SmsCbEtwsInfo getEtwsWarningInfo()
public boolean isPublicAlertMessage()
public boolean isEmergencyAlertMessage()
public boolean isEtwsMessage()
public boolean isCmasMessage()
public int getCmasMessageClass()
SmsCbCmasInfo.CMAS_CLASS_SEVERE_THREAT
, or
SmsCbCmasInfo.CMAS_CLASS_UNKNOWN
if this is not a CMAS alertpublic boolean isEtwsPopupAlert()
public boolean isEtwsEmergencyUserAlert()
public boolean isEtwsTestMessage()
public String getDateString(Context context)
context
- the context object