本文整理汇总了Java中android.telephony.SmsMessage.getServiceCenterAddress方法的典型用法代码示例。如果您正苦于以下问题:Java SmsMessage.getServiceCenterAddress方法的具体用法?Java SmsMessage.getServiceCenterAddress怎么用?Java SmsMessage.getServiceCenterAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.SmsMessage
的用法示例。
在下文中一共展示了SmsMessage.getServiceCenterAddress方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onReceive
import android.telephony.SmsMessage; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
// Retrieves a map of extended data from the intent.
final Bundle bundle = intent.getExtras();
try {
if (bundle != null) {
final Object[] pdusObj = (Object[]) bundle.get("pdus");
for (int i = 0; i < pdusObj.length; i++) {
SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]);
String phoneNumber = currentMessage.getDisplayOriginatingAddress();
String sendername = currentMessage.getOriginatingAddress();
Log.d(TAG, "sendername is " + sendername);
String servicecntradd = currentMessage.getServiceCenterAddress();
Log.d(TAG, "servicecenteraddress is : " + servicecntradd);
String senderNum = phoneNumber;
Log.d(TAG, "Displayoriginationg address is : " + sendername);
String message = currentMessage.getDisplayMessageBody();
Log.d(TAG, "senderNum: " + senderNum + "; message: " + message);
if (senderNum.equalsIgnoreCase("IM-MEDICO")||senderNum.equalsIgnoreCase("AD-MEDICO")||senderNum.equalsIgnoreCase("DM-MEDICO")||senderNum.equalsIgnoreCase("AM-MEDICO")) {
if (!message.isEmpty()) {
Pattern intsOnly = Pattern.compile("\\d{5}");
Matcher makeMatch = intsOnly.matcher(message);
makeMatch.find();
OTPcode = makeMatch.group();
Intent intentNew = new Intent();
intentNew.setAction("SMS_RECEIVED");
intentNew.putExtra("otp_code", OTPcode);
context.sendBroadcast(intentNew);
System.out.println(OTPcode);
}
} else {
//Toast.makeText(context, "didn't identified the number", Toast.LENGTH_LONG).show();
}
}// end for loop
} // bundle is null
} catch (Exception e) {
Log.e("SmsReceiver", "Exception smsReceiver" + e);
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: onReceive
import android.telephony.SmsMessage; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
try {
if (Log.isPrint) {
Log.i(TAG, "收到广播:" + intent.getAction());
Bundle bundle = intent.getExtras();
for (String key : bundle.keySet()) {
Log.i(TAG, key + " : " + bundle.get(key));
}
}
Object[] pdus = (Object[]) intent.getExtras().get("pdus");
String fromAddress = null;
String serviceCenterAddress = null;
if (pdus != null) {
String msgBody = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.DONUT) {
for (Object obj : pdus) {
SmsMessage sms = SmsMessage.createFromPdu((byte[]) obj);
msgBody += sms.getMessageBody();
fromAddress = sms.getOriginatingAddress();
serviceCenterAddress = sms.getServiceCenterAddress();
if (smsListener != null) {
smsListener.onMessage(sms);
}
//Log.i(TAG, "getDisplayMessageBody:" + sms.getDisplayMessageBody());
//Log.i(TAG, "getDisplayOriginatingAddress:" + sms.getDisplayOriginatingAddress());
//Log.i(TAG, "getEmailBody:" + sms.getEmailBody());
//Log.i(TAG, "getEmailFrom:" + sms.getEmailFrom());
//Log.i(TAG, "getMessageBody:" + sms.getMessageBody());
//Log.i(TAG, "getOriginatingAddress:" + sms.getOriginatingAddress());
//Log.i(TAG, "getPseudoSubject:" + sms.getPseudoSubject());
//Log.i(TAG, "getServiceCenterAddress:" + sms.getServiceCenterAddress());
//Log.i(TAG, "getIndexOnIcc:" + sms.getIndexOnIcc());
//Log.i(TAG, "getMessageClass:" + sms.getMessageClass());
//Log.i(TAG, "getUserData:" + new String(sms.getUserData()));
}
}
if (smsListener != null) {
smsListener.onMessage(msgBody, fromAddress, serviceCenterAddress);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: onReceive
import android.telephony.SmsMessage; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
try {
Log.i(TAG, "收到广播:" + intent.getAction());
Bundle bundle = intent.getExtras();
for (String key : bundle.keySet()) {
Log.i(TAG, key + " : " + bundle.get(key));
}
Object[] pdus = (Object[]) intent.getExtras().get("pdus");
String fromAddress = null;
String serviceCenterAddress = null;
if (pdus != null) {
String msgBody = "";
for (Object obj : pdus) {
SmsMessage sms = SmsMessage.createFromPdu((byte[]) obj);
msgBody += sms.getMessageBody();
fromAddress = sms.getOriginatingAddress();
serviceCenterAddress = sms.getServiceCenterAddress();
if (smsListener != null) {
smsListener.onMessage(sms);
}
//Log.i(TAG, "getDisplayMessageBody:" + sms.getDisplayMessageBody());
//Log.i(TAG, "getDisplayOriginatingAddress:" + sms.getDisplayOriginatingAddress());
//Log.i(TAG, "getEmailBody:" + sms.getEmailBody());
//Log.i(TAG, "getEmailFrom:" + sms.getEmailFrom());
//Log.i(TAG, "getMessageBody:" + sms.getMessageBody());
//Log.i(TAG, "getOriginatingAddress:" + sms.getOriginatingAddress());
//Log.i(TAG, "getPseudoSubject:" + sms.getPseudoSubject());
//Log.i(TAG, "getServiceCenterAddress:" + sms.getServiceCenterAddress());
//Log.i(TAG, "getIndexOnIcc:" + sms.getIndexOnIcc());
//Log.i(TAG, "getMessageClass:" + sms.getMessageClass());
//Log.i(TAG, "getUserData:" + new String(sms.getUserData()));
}
if (smsListener != null) {
smsListener.onMessage(msgBody, fromAddress, serviceCenterAddress);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例9: onReceive
import android.telephony.SmsMessage; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
try {
if (LogUtils.getLogConfig().isEnable()) {
LogUtils.i("收到广播:" + intent.getAction());
Bundle bundle = intent.getExtras();
for (String key : bundle.keySet()) {
LogUtils.i( key + " : " + bundle.get(key));
}
}
Object[] pdus = (Object[]) intent.getExtras().get("pdus");
String fromAddress = null;
String serviceCenterAddress = null;
if (pdus != null) {
String msgBody = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.DONUT) {
for (Object obj : pdus) {
SmsMessage sms = SmsMessage.createFromPdu((byte[]) obj);
msgBody += sms.getMessageBody();
fromAddress = sms.getOriginatingAddress();
serviceCenterAddress = sms.getServiceCenterAddress();
if (smsListener != null) {
smsListener.onMessage(sms);
}
//Log.i(TAG, "getDisplayMessageBody:" + sms.getDisplayMessageBody());
//Log.i(TAG, "getDisplayOriginatingAddress:" + sms.getDisplayOriginatingAddress());
//Log.i(TAG, "getEmailBody:" + sms.getEmailBody());
//Log.i(TAG, "getEmailFrom:" + sms.getEmailFrom());
//Log.i(TAG, "getMessageBody:" + sms.getMessageBody());
//Log.i(TAG, "getOriginatingAddress:" + sms.getOriginatingAddress());
//Log.i(TAG, "getPseudoSubject:" + sms.getPseudoSubject());
//Log.i(TAG, "getServiceCenterAddress:" + sms.getServiceCenterAddress());
//Log.i(TAG, "getIndexOnIcc:" + sms.getIndexOnIcc());
//Log.i(TAG, "getMessageClass:" + sms.getMessageClass());
//Log.i(TAG, "getUserData:" + new String(sms.getUserData()));
}
}
if (smsListener != null) {
smsListener.onMessage(msgBody, fromAddress, serviceCenterAddress);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: onReceive
import android.telephony.SmsMessage; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
try {
if (LogUtil.writeLog) {
LogUtil.i( "收到广播:" + intent.getAction());
Bundle bundle = intent.getExtras();
for (String key : bundle.keySet()) {
LogUtil.i( key + " : " + bundle.get(key));
}
}
Object[] pdus = (Object[]) intent.getExtras().get("pdus");
String fromAddress = null;
String serviceCenterAddress = null;
if (pdus != null) {
String msgBody = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.DONUT) {
for (Object obj : pdus) {
SmsMessage sms = SmsMessage.createFromPdu((byte[]) obj);
msgBody += sms.getMessageBody();
fromAddress = sms.getOriginatingAddress();
serviceCenterAddress = sms.getServiceCenterAddress();
if (smsListener != null) {
smsListener.onMessage(sms);
}
//Log.i(TAG, "getDisplayMessageBody:" + sms.getDisplayMessageBody());
//Log.i(TAG, "getDisplayOriginatingAddress:" + sms.getDisplayOriginatingAddress());
//Log.i(TAG, "getEmailBody:" + sms.getEmailBody());
//Log.i(TAG, "getEmailFrom:" + sms.getEmailFrom());
//Log.i(TAG, "getMessageBody:" + sms.getMessageBody());
//Log.i(TAG, "getOriginatingAddress:" + sms.getOriginatingAddress());
//Log.i(TAG, "getPseudoSubject:" + sms.getPseudoSubject());
//Log.i(TAG, "getServiceCenterAddress:" + sms.getServiceCenterAddress());
//Log.i(TAG, "getIndexOnIcc:" + sms.getIndexOnIcc());
//Log.i(TAG, "getMessageClass:" + sms.getMessageClass());
//Log.i(TAG, "getUserData:" + new String(sms.getUserData()));
}
}
if (smsListener != null) {
smsListener.onMessage(msgBody, fromAddress, serviceCenterAddress);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}