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

How to use
getCallCapablePhoneAccounts
method
in
android.telecom.TelecomManager

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

origin: robolectric/robolectric

@Test
@Config(minSdk = M)
public void getCallCapablePhoneAccounts() {
 PhoneAccountHandle callCapableHandle = createHandle("id1");
 telecomService.registerPhoneAccount(PhoneAccount.builder(callCapableHandle, "enabled")
   .setIsEnabled(true)
   .build());
 PhoneAccountHandle notCallCapableHandler = createHandle("id2");
 telecomService.registerPhoneAccount(PhoneAccount.builder(notCallCapableHandler, "disabled")
   .setIsEnabled(false)
   .build());
 List<PhoneAccountHandle> callCapablePhoneAccounts = telecomService.getCallCapablePhoneAccounts();
 assertThat(callCapablePhoneAccounts).contains(callCapableHandle);
 assertThat(callCapablePhoneAccounts).doesNotContain(notCallCapableHandler);
}
origin: geniusgithub/AndroidDialer

/**
 * Returns a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
 * calls. The returned list includes only those accounts which have been explicitly enabled
 * by the user.
 *
 * @param telecomManager the {@link TelecomManager} used for method calls, if possible.
 * @return A list of PhoneAccountHandle objects.
 */
public static List<PhoneAccountHandle> getCallCapablePhoneAccounts(
    @Nullable TelecomManager telecomManager) {
  if (telecomManager != null && (CompatUtils.isMarshmallowCompatible()
      || CompatUtils.isMethodAvailable(TELECOM_MANAGER_CLASS,
          "getCallCapablePhoneAccounts"))) {
    return telecomManager.getCallCapablePhoneAccounts();
  }
  return new ArrayList<>();
}
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

List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts();
for (PhoneAccountHandle accountHandle : accountHandles) {
  PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle);
android.telecomTelecomManagergetCallCapablePhoneAccounts

Popular methods of TelecomManager

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

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • requestLocationUpdates (LocationManager)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • IsNull (org.hamcrest.core)
    Is the value null?
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 12 Jupyter Notebook extensions
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