热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Intentintent=newCallIntentBuilder(number)

35.找到了吧,最初的构造数据是number35.回到最初的起点finalIntentintentnewCallIntentBuilder(number).set

//35.找到了吧,最初的构造数据是number
//35.回到最初的起点
final Intent intent = new CallIntentBuilder(number).setCallInitiationType(LogState.INITIATION_DIALPAD).build();

IntentUtil.CallIntentBuilder

public CallIntentBuilder(String number) {this(CallUtil.getCallUri(number));
} public CallIntentBuilder(Uri uri) {mUri = uri;
} public CallIntentBuilder setCallInitiationType(int initiationType) {mCallInitiationType = initiationType;return this;
}public Intent build() {return getCallIntent(mUri,mPhoneAccountHandle,mIsVideoCall ? VideoProfile.STATE_BIDIRECTIONAL : VideoProfile.STATE_AUDIO_ONLY,mCallInitiationType);
}/*** Create a call intent that can be used to place a call.* 构建intent,uri目标号码,* @param uri Address to place the call to.* @param accountHandle {@link PhoneAccountHandle} to place the call with.此处为空* @param videoState Initial video state of the call.好像是是否是video ?audio only* 初始化电话的类型,应该是有系统phone拨号和其他调用拨号之类的区分* @param callIntiationType The UI affordance the call was initiated by.* @return Call intent with provided extras and data.*/
public static Intent getCallIntent(Uri uri, PhoneAccountHandle accountHandle, int videoState, int callIntiationType) {//String CALL_ACTION = Intent.ACTION_CALL;final Intent intent = new Intent(CALL_ACTION, uri);intent.putExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, videoState);final Bundle b = new Bundle();b.putInt(EXTRA_CALL_INITIATION_TYPE, callIntiationType);intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, b);if (accountHandle != null) {intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle);}return intent;
}

CallUtil

public static Uri getCallUri(String number) {//if (PhoneNumberHelper.isUriNumber(number)) {//String SCHEME_SIP = "sip"; return Uri.fromParts(PhoneAccount.SCHEME_SIP, number, null);}return Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null);
}

PhoneNumberHelper

public static boolean isUriNumber(String number) {// Note we allow either "@" or "%40" to indicate a URI, in case// the passed-in string is URI-escaped. (Neither "@" nor "%40"// will ever be found in a legal PSTN number.)return number != null && (number.contains("@") || number.contains("%40"));
}

推荐阅读
author-avatar
小鱼2502907687
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有