public static void doSendSMSTo(Context context, String phoneNumber, String message) { if (PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber)) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + phoneNumber)); intent.putExtra("sms_body", message); context.startActivity(intent); } }
/** * 跳转至发送短信界面(自动设置接收方的号码) * * @param mContext * @param strPhone 手机号码 * @param strMsgContext 短信内容 */ public static void toSendMessageActivity( Context mContext, String strPhone, String strMsgContext) { if (PhoneNumberUtils.isGlobalPhoneNumber(strPhone)) { Uri uri = Uri.parse("smsto:" + strPhone); Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri); sendIntent.putExtra("sms_body", strMsgContext); mContext.startActivity(sendIntent); } }
/** * Performs another lookup if previous lookup fails and it's a SIP call and the peer's username is * all numeric. Look up the username as it could be a PSTN number in the contact database. * * @param context the query context * @param number the original phone number, could be a SIP URI * @param previousResult the result of previous lookup * @return previousResult if it's not the case */ static CallerInfo doSecondaryLookupIfNecessary( Context context, String number, CallerInfo previousResult) { if (!previousResult.contactExists && PhoneNumberUtils.isUriNumber(number)) { String username = PhoneNumberUtils.getUsernameFromUriNumber(number); if (PhoneNumberUtils.isGlobalPhoneNumber(username)) { previousResult = getCallerInfo( context, Uri.withAppendedPath( PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, Uri.encode(username))); } } return previousResult; }