当前位置: 首页>>代码示例>>Java>>正文


Java SmsMessage.getMessageClass方法代码示例

本文整理汇总了Java中android.telephony.SmsMessage.getMessageClass方法的典型用法代码示例。如果您正苦于以下问题:Java SmsMessage.getMessageClass方法的具体用法?Java SmsMessage.getMessageClass怎么用?Java SmsMessage.getMessageClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telephony.SmsMessage的用法示例。


在下文中一共展示了SmsMessage.getMessageClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isExemption

import android.telephony.SmsMessage; //导入方法依赖的package包/类
private boolean isExemption(SmsMessage message, String messageBody) {

    // ignore CLASS0 ("flash") messages
    if (message.getMessageClass() == SmsMessage.MessageClass.CLASS_0)
      return true;

    // ignore OTP messages from Sparebank1 (Norwegian bank)
    if (messageBody.startsWith("Sparebank1://otp?")) {
      return true;
    }

    return
      message.getOriginatingAddress().length() < 7 &&
      (messageBody.toUpperCase().startsWith("//ANDROID:") || // Sprint Visual Voicemail
       messageBody.startsWith("//BREW:")); //BREW stands for “Binary Runtime Environment for Wireless"
  }
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:17,代码来源:SmsListener.java

示例2: isExemption

import android.telephony.SmsMessage; //导入方法依赖的package包/类
private boolean isExemption(SmsMessage message, String messageBody) {

        // ignore CLASS0 ("flash") messages
        if (message.getMessageClass() == SmsMessage.MessageClass.CLASS_0)
            return true;

        // ignore OTP messages from Sparebank1 (Norwegian bank)
        if (messageBody.startsWith("Sparebank1://otp?")) {
            return true;
        }

        return
                message.getOriginatingAddress().length() < 7 &&
                        (messageBody.toUpperCase().startsWith("//ANDROID:") || // Sprint Visual Voicemail
                                messageBody.startsWith("//BREW:")); //BREW stands for “Binary Runtime Environment for Wireless"
    }
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:17,代码来源:SmsListener.java

示例3: insertMessage

import android.telephony.SmsMessage; //导入方法依赖的package包/类
/**
 * If the message is a class-zero message, display it immediately
 * and return null.  Otherwise, store it using the
 * <code>ContentResolver</code> and return the
 * <code>Uri</code> of the thread containing this message
 * so that we can use it for notification.
 */
private Uri insertMessage(Context context, SmsMessage[] msgs, int error, String format) {
    // Build the helper classes to parse the messages.
    SmsMessage sms = msgs[0];

    if (sms.getMessageClass() == SmsMessage.MessageClass.CLASS_0) {
        displayClassZeroMessage(context, sms, format);
        return null;
    } else if (sms.isReplace()) {
        return replaceMessage(context, msgs, error);
    } else {
        return storeMessage(context, msgs, error);
    }
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:21,代码来源:SmsReceiverService.java

示例4: SmsMmsMessage

import android.telephony.SmsMessage; //导入方法依赖的package包/类
/**
 * Construct SmsMmsMessage given a raw message (created from pdu), used for
 * when a message is initially received via the network.
 */
public SmsMmsMessage(Context _context, SmsMessage[] messages, long _timestamp) {
    SmsMessage sms = messages[0];

    context = _context;
    timestamp = _timestamp;
    messageType = MESSAGE_TYPE_SMS;

    /*
     * Fetch data from raw SMS
     */
    fromAddress = sms.getDisplayOriginatingAddress();
    fromEmailGateway = sms.isEmail();
    messageClass = sms.getMessageClass();

    String body = "";

    try {
        if (messages.length == 1 || sms.isReplace()) {
            body = sms.getDisplayMessageBody();
        } else {
            StringBuilder bodyText = new StringBuilder();
            for (int i = 0; i < messages.length; i++) {
                bodyText.append(messages[i].getMessageBody());
            }
            body = bodyText.toString();
        }
    } catch (Exception e) {
    }
    messageBody = body;

    /*
     * Lookup the rest of the info from the system db
     */

    SMSUtils.ContactIdentification contactIdentify = null;

    // If this SMS is from an email gateway then lookup contactId by email
    // address
    if (fromEmailGateway) {
        contactIdentify = SMSUtils.getPersonIdFromEmail(context, fromAddress);
        contactName = fromAddress;
    } else { // Else lookup contactId by phone number
        contactIdentify = SMSUtils.getPersonIdFromPhoneNumber(context, fromAddress);
        contactName = PhoneNumberUtils.formatNumber(fromAddress);
    }

    if (contactIdentify != null) {
        contactId = contactIdentify.contactId;
        contactLookupKey = contactIdentify.contactLookup;
        contactName = contactIdentify.contactName;
    }

    unreadCount = SMSUtils.getUnreadMessagesCount(context, timestamp, messageBody);
}
 
开发者ID:RSenApps,项目名称:Commandr-Android,代码行数:59,代码来源:SmsMmsMessage.java

示例5: SmsMmsMessage

import android.telephony.SmsMessage; //导入方法依赖的package包/类
/**
 * Construct SmsMmsMessage given a raw message (created from pdu), used for
 * when a message is initially received via the network.
 */
public SmsMmsMessage(Context _context, SmsMessage[] messages, long _timestamp) {
    SmsMessage sms = messages[0];

    context = _context;
    timestamp = _timestamp;
    messageType = MESSAGE_TYPE_SMS;

    /*
     * Fetch data from raw SMS
     */
    fromAddress = sms.getDisplayOriginatingAddress();
    fromEmailGateway = sms.isEmail();
    messageClass = sms.getMessageClass();

    String body = "";

    try {
        if (messages.length == 1 || sms.isReplace()) {
            body = sms.getDisplayMessageBody();
        } else {
            StringBuilder bodyText = new StringBuilder();
            for (int i = 0; i < messages.length; i++) {
                bodyText.append(messages[i].getMessageBody());
            }
            body = bodyText.toString();
        }
    } catch (Exception e) {
        if (BuildConfig.DEBUG) Log.v("SmsMmsMessage<init> exception: " + e.toString());
    }
    messageBody = body;

    /*
     * Lookup the rest of the info from the system db
     */

    ContactIdentification contactIdentify = null;

    // If this SMS is from an email gateway then lookup contactId by email
    // address
    if (fromEmailGateway) {
        if (BuildConfig.DEBUG) Log.v("Sms came from email gateway");
        contactIdentify = SmsPopupUtils.getPersonIdFromEmail(context, fromAddress);
        contactName = fromAddress;
    } else { // Else lookup contactId by phone number
        if (BuildConfig.DEBUG) Log.v("Sms did NOT come from email gateway");
        contactIdentify = SmsPopupUtils.getPersonIdFromPhoneNumber(context, fromAddress);
        contactName = PhoneNumberUtils.formatNumber(fromAddress);
    }

    if (contactIdentify != null) {
        contactId = contactIdentify.contactId;
        contactLookupKey = contactIdentify.contactLookup;
        contactName = contactIdentify.contactName;
    }

    unreadCount = SmsPopupUtils.getUnreadMessagesCount(context, timestamp, messageBody);
}
 
开发者ID:minhkhoi209,项目名称:EngLishReminder,代码行数:62,代码来源:SmsMmsMessage.java


注:本文中的android.telephony.SmsMessage.getMessageClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。