Tabnine Logo
TelecomManager.getPhoneAccount
Code IndexAdd Tabnine to your IDE (free)

How to use
getPhoneAccount
method
in
android.telecom.TelecomManager

Best Java code snippets using android.telecom.TelecomManager.getPhoneAccount (Showing top 7 results out of 315)

origin: robolectric/robolectric

@Test
@Config(minSdk = LOLLIPOP_MR1)
public void clearAccountsForPackage() {
 PhoneAccountHandle accountHandle1 = createHandle("a.package", "id1");
 telecomService.registerPhoneAccount(PhoneAccount.builder(accountHandle1, "another_package")
   .build());
 PhoneAccountHandle accountHandle2 = createHandle("some.other.package", "id2");
 telecomService.registerPhoneAccount(PhoneAccount.builder(accountHandle2, "another_package")
   .build());
 telecomService.clearAccountsForPackage(accountHandle1.getComponentName().getPackageName());
 assertThat(telecomService.getPhoneAccount(accountHandle1)).isNull();
 assertThat(telecomService.getPhoneAccount(accountHandle2)).isNotNull();
}
origin: robolectric/robolectric

@Test
public void registerAndUnRegister() {
 assertThat(shadowOf(telecomService).getAllPhoneAccountsCount()).isEqualTo(0);
 assertThat(shadowOf(telecomService).getAllPhoneAccounts()).hasSize(0);
 PhoneAccountHandle handler = createHandle("id");
 PhoneAccount phoneAccount = PhoneAccount.builder(handler, "main_account").build();
 telecomService.registerPhoneAccount(phoneAccount);
 assertThat(shadowOf(telecomService).getAllPhoneAccountsCount()).isEqualTo(1);
 assertThat(shadowOf(telecomService).getAllPhoneAccounts()).hasSize(1);
 assertThat(telecomService.getAllPhoneAccountHandles()).hasSize(1);
 assertThat(telecomService.getAllPhoneAccountHandles()).contains(handler);
 assertThat(telecomService.getPhoneAccount(handler).getLabel()).isEqualTo(phoneAccount.getLabel());
 telecomService.unregisterPhoneAccount(handler);
 assertThat(shadowOf(telecomService).getAllPhoneAccountsCount()).isEqualTo(0);
 assertThat(shadowOf(telecomService).getAllPhoneAccounts()).hasSize(0);
 assertThat(telecomService.getAllPhoneAccountHandles()).hasSize(0);
}
origin: geniusgithub/AndroidDialer

/**
 * Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes
 * resources which can be used in a user interface.
 *
 * @param telecomManager the {@link TelecomManager} used for method calls, if possible.
 * @param account The {@link PhoneAccountHandle}.
 * @return The {@link PhoneAccount} object or null if it doesn't exist.
 */
@Nullable
public static PhoneAccount getPhoneAccount(@Nullable TelecomManager telecomManager,
    @Nullable PhoneAccountHandle accountHandle) {
  if (telecomManager != null && (CompatUtils.isMethodAvailable(
      TELECOM_MANAGER_CLASS, "getPhoneAccount", PhoneAccountHandle.class))) {
    return telecomManager.getPhoneAccount(accountHandle);
  }
  return null;
}
origin: geniusgithub/AndroidDialer

final PhoneAccount account = telecomManager.getPhoneAccount(mPhoneAccountHandle);
origin: geniusgithub/AndroidDialer

PhoneAccount account = mTelecomManager.getPhoneAccount(accountHandle);
if (account == null) {
  return rowView;
origin: geniusgithub/AndroidDialer

  /**
   * Determines if one of the call capable phone accounts defined supports calling with a subject
   * specified.
   *
   * @param context The context.
   * @return {@code true} if one of the call capable phone accounts supports calling with a
   *      subject specified, {@code false} otherwise.
   */
  public static boolean isCallWithSubjectSupported(Context context) {
    if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE)
        || !CompatUtils.isCallSubjectCompatible()) {
      return false;
    }
    TelecomManager telecommMgr = (TelecomManager)
        context.getSystemService(Context.TELECOM_SERVICE);
    if (telecommMgr == null) {
      return false;
    }

    List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts();
    for (PhoneAccountHandle accountHandle : accountHandles) {
      PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle);
      if (account != null && account.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT)) {
        return true;
      }
    }
    return false;
  }
}
origin: geniusgithub/AndroidDialer

PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle);
if (account != null) {
  if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) {
android.telecomTelecomManagergetPhoneAccount

Popular methods of TelecomManager

  • getDefaultDialerPackage
  • getCallCapablePhoneAccounts
  • isInCall
  • silenceRinger
  • addNewIncomingCall
  • addNewUnknownCall
  • cancelMissedCallsNotification
  • clearAccountsForPackage
  • createManageBlockedNumbersIntent
  • getAdnUriForPhoneAccount
  • getAllPhoneAccountHandles
  • getConnectionManager
  • getAllPhoneAccountHandles,
  • getConnectionManager,
  • getDefaultOutgoingPhoneAccount,
  • getLine1Number,
  • getPhoneAccountsForPackage,
  • getPhoneAccountsSupportingScheme,
  • getSimCallManager,
  • getVoiceMailNumber,
  • handleMmi

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Reference (javax.naming)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Table (org.hibernate.mapping)
    A relational table
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now