本文整理汇总了Java中android.telephony.SmsMessage.getProtocolIdentifier方法的典型用法代码示例。如果您正苦于以下问题:Java SmsMessage.getProtocolIdentifier方法的具体用法?Java SmsMessage.getProtocolIdentifier怎么用?Java SmsMessage.getProtocolIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.SmsMessage
的用法示例。
在下文中一共展示了SmsMessage.getProtocolIdentifier方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IncomingTextMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
public IncomingTextMessage(SmsMessage message) {
this.message = message.getDisplayMessageBody();
this.sender = message.getDisplayOriginatingAddress();
this.senderDeviceId = TextSecureAddress.DEFAULT_DEVICE_ID;
this.protocol = message.getProtocolIdentifier();
this.serviceCenterAddress = message.getServiceCenterAddress();
this.replyPathPresent = message.isReplyPathPresent();
this.pseudoSubject = message.getPseudoSubject();
this.sentTimestampMillis = message.getTimestampMillis();
this.groupId = null;
this.push = false;
}
示例2: IncomingTextMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
public IncomingTextMessage(SmsMessage message, int subscriptionId) {
this.message = message.getDisplayMessageBody();
this.sender = message.getDisplayOriginatingAddress();
this.senderDeviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
this.protocol = message.getProtocolIdentifier();
this.serviceCenterAddress = message.getServiceCenterAddress();
this.replyPathPresent = message.isReplyPathPresent();
this.pseudoSubject = message.getPseudoSubject();
this.sentTimestampMillis = message.getTimestampMillis();
this.subscriptionId = subscriptionId;
this.expiresInMillis = 0;
this.groupId = null;
this.push = false;
}
示例3: IncomingTextMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
public IncomingTextMessage(SmsMessage message) {
this.message = message.getDisplayMessageBody();
this.sender = message.getDisplayOriginatingAddress();
this.senderDeviceId = PushAddress.DEFAULT_DEVICE_ID;
this.protocol = message.getProtocolIdentifier();
this.serviceCenterAddress = message.getServiceCenterAddress();
this.replyPathPresent = message.isReplyPathPresent();
this.pseudoSubject = message.getPseudoSubject();
this.sentTimestampMillis = message.getTimestampMillis();
this.groupId = null;
this.push = false;
}
示例4: IncomingTextMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
public IncomingTextMessage(SmsMessage message, int subscriptionId, boolean receivedWhenLocked) {
this.message = message.getDisplayMessageBody();
this.sender = message.getDisplayOriginatingAddress();
this.senderDeviceId = 1;
this.protocol = message.getProtocolIdentifier();
this.serviceCenterAddress = message.getServiceCenterAddress();
this.replyPathPresent = message.isReplyPathPresent();
this.pseudoSubject = message.getPseudoSubject();
this.sentTimestampMillis = message.getTimestampMillis();
this.subscriptionId = subscriptionId;
this.groupId = null;
this.push = false;
this.receivedWhenLocked = receivedWhenLocked;
}
示例5: IncomingTextMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
public IncomingTextMessage(SmsMessage message) {
this.message = message.getDisplayMessageBody();
this.sender = message.getDisplayOriginatingAddress();
this.senderDeviceId = RecipientDevice.DEFAULT_DEVICE_ID;
this.protocol = message.getProtocolIdentifier();
this.serviceCenterAddress = message.getServiceCenterAddress();
this.replyPathPresent = message.isReplyPathPresent();
this.pseudoSubject = message.getPseudoSubject();
this.sentTimestampMillis = message.getTimestampMillis();
this.groupId = null;
this.push = false;
}
示例6: replaceMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
private Uri replaceMessage(SmsMessage sms) {
ContentValues values = extractContentValues(sms);
values.put(Inbox.BODY, sms.getMessageBody());
ContentResolver resolver = getContentResolver();
String originatingAddress = sms.getOriginatingAddress();
int protocolIdentifier = sms.getProtocolIdentifier();
String selection = Sms.ADDRESS + " = ? AND " + Sms.PROTOCOL + " = ?";
String[] selectionArgs = new String[] { originatingAddress,
Integer.toString(protocolIdentifier) };
Cursor cursor = SqliteWrapper.query(this, resolver, Inbox.CONTENT_URI,
REPLACE_PROJECTION, selection, selectionArgs, null);
try {
if (cursor.moveToFirst()) {
long messageId = cursor.getLong(REPLACE_COLUMN_ID);
Uri messageUri = ContentUris.withAppendedId(
Sms.CONTENT_URI, messageId);
SqliteWrapper.update(this, resolver, messageUri, values,
null, null);
return messageUri;
}
} finally {
cursor.close();
}
return storeMessage(sms);
}
示例7: replaceMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
/**
* This method is used if this is a "replace short message" SMS.
* We find any existing message that matches the incoming
* message's originating address and protocol identifier. If
* there is one, we replace its fields with those of the new
* message. Otherwise, we store the new message as usual.
*
* See TS 23.040 9.2.3.9.
*/
private Uri replaceMessage(Context context, SmsMessage[] msgs, int error) {
SmsMessage sms = msgs[0];
ContentValues values = extractContentValues(sms);
values.put(Sms.ERROR_CODE, error);
int pduCount = msgs.length;
if (pduCount == 1) {
// There is only one part, so grab the body directly.
values.put(Inbox.BODY, replaceFormFeeds(sms.getDisplayMessageBody()));
} else {
// Build up the body from the parts.
StringBuilder body = new StringBuilder();
for (int i = 0; i < pduCount; i++) {
sms = msgs[i];
if (sms.mWrappedSmsMessage != null) {
body.append(sms.getDisplayMessageBody());
}
}
values.put(Inbox.BODY, replaceFormFeeds(body.toString()));
}
ContentResolver resolver = context.getContentResolver();
String originatingAddress = sms.getOriginatingAddress();
int protocolIdentifier = sms.getProtocolIdentifier();
String selection;
String[] selectionArgs;
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, " SmsReceiverService: replaceMessage:");
}
selection = Sms.ADDRESS + " = ? AND " +
Sms.PROTOCOL + " = ? AND " +
Sms.SUB_ID + " = ? ";
selectionArgs = new String[] {
originatingAddress, Integer.toString(protocolIdentifier),
Integer.toString(sms.getSubId())
};
Cursor cursor = SqliteWrapper.query(context, resolver, Inbox.CONTENT_URI,
REPLACE_PROJECTION, selection, selectionArgs, null);
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
long messageId = cursor.getLong(REPLACE_COLUMN_ID);
Uri messageUri = ContentUris.withAppendedId(
Sms.CONTENT_URI, messageId);
SqliteWrapper.update(context, resolver, messageUri,
values, null, null);
return messageUri;
}
} finally {
cursor.close();
}
}
return storeMessage(context, msgs, error);
}
示例8: replaceMessage
import android.telephony.SmsMessage; //导入方法依赖的package包/类
/**
* This method is used if this is a "replace short message" SMS.
* We find any existing message that matches the incoming
* message's originating address and protocol identifier. If
* there is one, we replace its fields with those of the new
* message. Otherwise, we store the new message as usual.
*
* See TS 23.040 9.2.3.9.
*/
private Uri replaceMessage(Context context, SmsMessage[] msgs, int error) {
SmsMessage sms = msgs[0];
ContentValues values = extractContentValues(sms);
values.put(Sms.ERROR_CODE, error);
int pduCount = msgs.length;
if (pduCount == 1) {
// There is only one part, so grab the body directly.
values.put(Inbox.BODY, replaceFormFeeds(sms.getDisplayMessageBody()));
} else {
// Build up the body from the parts.
StringBuilder body = new StringBuilder();
for (int i = 0; i < pduCount; i++) {
sms = msgs[i];
if (sms.mWrappedSmsMessage != null) {
body.append(sms.getDisplayMessageBody());
}
}
values.put(Inbox.BODY, replaceFormFeeds(body.toString()));
}
ContentResolver resolver = context.getContentResolver();
String originatingAddress = sms.getOriginatingAddress();
int protocolIdentifier = sms.getProtocolIdentifier();
String selection =
Sms.ADDRESS + " = ? AND " +
Sms.PROTOCOL + " = ?";
String[] selectionArgs = new String[] {
originatingAddress, Integer.toString(protocolIdentifier)
};
Cursor cursor = SqliteWrapper.query(context, resolver, Inbox.CONTENT_URI,
REPLACE_PROJECTION, selection, selectionArgs, null);
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
long messageId = cursor.getLong(REPLACE_COLUMN_ID);
Uri messageUri = ContentUris.withAppendedId(
Sms.CONTENT_URI, messageId);
SqliteWrapper.update(context, resolver, messageUri,
values, null, null);
return messageUri;
}
} finally {
cursor.close();
}
}
return storeMessage(context, msgs, error);
}