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


Java PhoneNumberUtils.isGlobalPhoneNumber方法代码示例

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


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

示例1: doCallPhoneTo

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/**
 * 调起系统打电话功能
 */
public void doCallPhoneTo(String phoneNumber) {
  if (PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber)) {
    if (mayCallPhone()) {
      Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
      if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE)
          != PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        //    ActivityCompat#requestPermissions
        // here to request the missing permissions, and then overriding
        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
        //                                          int[] grantResults)
        // to handle the case where the user grants the permission. See the documentation
        // for ActivityCompat#requestPermissions for more details.
        return;
      }
      startActivity(intent);
    }
  }
}
 
开发者ID:Lingzh0ng,项目名称:ITSM,代码行数:23,代码来源:MemberDetailsActivity.java

示例2: checkAddressCompletionStatus

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/**
 * Checks address completion status in the given profile.
 *
 * If the country code is not set or invalid, but all fields for the default locale's country
 * code are present, then the profile is deemed "complete." AutoflllAddress.toPaymentAddress()
 * will use the default locale to fill in a blank country code before sending the address to the
 * renderer.
 *
 * @param  profile The autofill profile containing the address information.
 * @return int     The completion status.
 */
@CompletionStatus
public static int checkAddressCompletionStatus(AutofillProfile profile) {
    int invalidFieldsCount = 0;
    int completionStatus = COMPLETE;

    if (!PhoneNumberUtils.isGlobalPhoneNumber(
                PhoneNumberUtils.stripSeparators(profile.getPhoneNumber().toString()))) {
        completionStatus = INVALID_PHONE_NUMBER;
        invalidFieldsCount++;
    }

    List<Integer> requiredFields = AutofillProfileBridge.getRequiredAddressFields(
            AutofillAddress.getCountryCode(profile));
    for (int fieldId : requiredFields) {
        if (fieldId == AddressField.RECIPIENT || fieldId == AddressField.COUNTRY) continue;
        if (!TextUtils.isEmpty(getProfileField(profile, fieldId))) continue;
        completionStatus = INVALID_ADDRESS;
        invalidFieldsCount++;
        break;
    }

    if (TextUtils.isEmpty(profile.getFullName())) {
        completionStatus = INVALID_RECIPIENT;
        invalidFieldsCount++;
    }

    if (invalidFieldsCount > 1) {
        completionStatus = INVALID_MULTIPLE_FIELDS;
    }

    return completionStatus;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:44,代码来源:AutofillAddress.java

示例3: doSendSMSTo

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/**
 * 调起系统发短信功能
 */
public void doSendSMSTo(String phoneNumber, String message) {
  if (PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber)) {
    Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + phoneNumber));
    intent.putExtra("sms_body", message);
    startActivity(intent);
  }
}
 
开发者ID:Lingzh0ng,项目名称:ITSM,代码行数:11,代码来源:MemberDetailsActivity.java

示例4: isValidPhone

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
public static boolean isValidPhone(String target) {
    if (target.equals("")) {
        return false;
    }
    else if(target.length()!=10){
    	return false;
    }
    else {
    	return PhoneNumberUtils.isGlobalPhoneNumber(target);
    }
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:12,代码来源:Validate.java

示例5: doSendSMSTo

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
private void doSendSMSTo(String phoneNumber) {
    if (PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber)) {
        Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + phoneNumber));
        mContext.startActivity(intent);
    }
}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:7,代码来源:WeatherNumberAdapter.java

示例6: isGlobalPhoneNumber

import android.telephony.PhoneNumberUtils; //导入方法依赖的package包/类
/**
 * Checks if the passed in phone number is valid according to global standards.
 *
 * @param phoneNumber the phone number to be validated.
 * @return true if valid, false otherwise
 */
public static boolean isGlobalPhoneNumber(String phoneNumber) {
    return !TextUtils.isEmpty(phoneNumber)
            && PhoneNumberUtils.isGlobalPhoneNumber(phoneNumber);
}
 
开发者ID:rahulrvp,项目名称:android-utils-lib,代码行数:11,代码来源:ValidationUtils.java


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