當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。