Java Code Examples for android.telecom.TelecomManager#registerPhoneAccount()
The following examples show how to use
android.telecom.TelecomManager#registerPhoneAccount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RNCallKeepModule.java From react-native-callkeep with ISC License | 6 votes |
private void registerPhoneAccount(Context appContext) { if (!isConnectionServiceAvailable()) { return; } ComponentName cName = new ComponentName(this.getAppContext(), VoiceConnectionService.class); String appName = this.getApplicationName(appContext); handle = new PhoneAccountHandle(cName, appName); PhoneAccount.Builder builder = new PhoneAccount.Builder(handle, appName) .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER); if (_settings != null && _settings.hasKey("imageName")) { int identifier = appContext.getResources().getIdentifier(_settings.getString("imageName"), "drawable", appContext.getPackageName()); Icon icon = Icon.createWithResource(appContext, identifier); builder.setIcon(icon); } PhoneAccount account = builder.build(); telephonyManager = (TelephonyManager) this.getAppContext().getSystemService(Context.TELEPHONY_SERVICE); telecomManager = (TelecomManager) this.getAppContext().getSystemService(Context.TELECOM_SERVICE); telecomManager.registerPhoneAccount(account); }
Example 2
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.O) protected PhoneAccountHandle addAccountToTelecomManager(){ TelecomManager tm=(TelecomManager) getSystemService(TELECOM_SERVICE); TLRPC.User self=UserConfig.getInstance(currentAccount).getCurrentUser(); PhoneAccountHandle handle=new PhoneAccountHandle(new ComponentName(this, TelegramConnectionService.class), ""+self.id); PhoneAccount account=new PhoneAccount.Builder(handle, ContactsController.formatName(self.first_name, self.last_name)) .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED) .setIcon(Icon.createWithResource(this, R.drawable.ic_launcher)) .setHighlightColor(0xff2ca5e0) .addSupportedUriScheme("sip") .build(); tm.registerPhoneAccount(account); return handle; }
Example 3
Source File: VoIPBaseService.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.O) protected PhoneAccountHandle addAccountToTelecomManager(){ TelecomManager tm=(TelecomManager) getSystemService(TELECOM_SERVICE); TLRPC.User self=UserConfig.getInstance(currentAccount).getCurrentUser(); PhoneAccountHandle handle=new PhoneAccountHandle(new ComponentName(this, TelegramConnectionService.class), ""+self.id); PhoneAccount account=new PhoneAccount.Builder(handle, ContactsController.formatName(self.first_name, self.last_name)) .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED) .setIcon(Icon.createWithResource(this, R.drawable.ic_launcher)) .setHighlightColor(0xff2ca5e0) .addSupportedUriScheme("sip") .build(); tm.registerPhoneAccount(account); return handle; }
Example 4
Source File: VoIPBaseService.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.O) protected PhoneAccountHandle addAccountToTelecomManager(){ TelecomManager tm=(TelecomManager) getSystemService(TELECOM_SERVICE); TLRPC.User self=UserConfig.getInstance(currentAccount).getCurrentUser(); PhoneAccountHandle handle=new PhoneAccountHandle(new ComponentName(this, TelegramConnectionService.class), ""+self.id); PhoneAccount account=new PhoneAccount.Builder(handle, ContactsController.formatName(self.first_name, self.last_name)) .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED) .setIcon(Icon.createWithResource(this, R.drawable.ic_launcher_dr)) .setHighlightColor(0xff2ca5e0) .addSupportedUriScheme("sip") .build(); tm.registerPhoneAccount(account); return handle; }
Example 5
Source File: VoIPBaseService.java From Telegram with GNU General Public License v2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.O) protected PhoneAccountHandle addAccountToTelecomManager(){ TelecomManager tm=(TelecomManager) getSystemService(TELECOM_SERVICE); TLRPC.User self=UserConfig.getInstance(currentAccount).getCurrentUser(); PhoneAccountHandle handle=new PhoneAccountHandle(new ComponentName(this, TelegramConnectionService.class), ""+self.id); PhoneAccount account=new PhoneAccount.Builder(handle, ContactsController.formatName(self.first_name, self.last_name)) .setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED) .setIcon(Icon.createWithResource(this, R.drawable.ic_launcher_dr)) .setHighlightColor(0xff2ca5e0) .addSupportedUriScheme("sip") .build(); tm.registerPhoneAccount(account); return handle; }