
表现…
<service androID:name=".MyConnectionService" androID:label="example" androID:permission="androID.permission.BIND_TELECOM_CONNECTION_SERVICE"> <intent-filter> <action androID:name="androID.telecom.ConnectionService"/> </intent-filter></service>
活动…
TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);if (androID.os.Build.VERSION.SDK_INT >= androID.os.Build.VERSION_CODES.M) { PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle( new Componentname(this.getApplicationContext(),MyConnectionService.class),"example"); PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle,"example").setCapabilitIEs(PhoneAccount.CAPABIliTY_CALL_PROVIDER).build(); tm.registerPhoneAccount(phoneAccount); Bundle extras = new Bundle(); Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL,mNumber.getText().toString(),null); extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS,uri); extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,phoneAccountHandle); tm.addNewIncomingCall(phoneAccountHandle,extras);} MyConnectionService,我希望至少能看到onCreateIncomingConnection生成的Log中的内容
@RequiresAPI(API = Build.VERSION_CODES.M) public class MyConnectionService extends ConnectionService { private static String TAG = "MyConnectionService";public MyConnectionService() {}@OverrIDepublic Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerPhoneAccount,ConnectionRequest request) {Log.i(TAG,"onCreateIncomingConnection");return super.onCreateIncomingConnection(connectionManagerPhoneAccount,request);}}解决方法 我将MyConnectionService重命名为MyService – 开始工作.奇怪的! 总结 以上是内存溢出为你收集整理的Android TelecomManager中的addIncomingCall没有做任何事情全部内容,希望文章能够帮你解决Android TelecomManager中的addIncomingCall没有做任何事情所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)