4

I'm trying to implement a custom ConnectionService in my custom telephony-app. According to the documentation I need to select my registered PhoneAccount as default in the Phones settings menu. However when I'm registering a PhoneAccount to use the native telephony stack the PhoneAccount does not seem to show up for use.

Let me show you what I got working so far. This code registers a PhoneAccount that "...is not allowed to manage or place calls from the built-in telephony stack"

    PhoneAccount.Builder builder = new PhoneAccount.Builder(phoneAccountHandle, "CustomAccount");
    builder.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER);
    PhoneAccount phoneAccount = builder.build();
    telecomManager.registerPhoneAccount(phoneAccount);

That make a selectable PhoneAccount show up under Setting > Calls > Calling Accounts. Placing calls using this account does bind to my implementation of ConnectionService, but won't be able to acually call anywhere.

The capability I actually want to set is PhoneAccount.CAPABILITY_CONNECTION_MANAGER, which does use the built-in stack. But doing so does entirely remove the account from the menu and makes it unable to pick as default.

Any ideas about what I might be doing wrong here?

PS: A continuation of my previous question (register new PhoneAccount for telecom).

Update: Here's the declaration in my AndroidManifest.xml, just in case:

       <service android:name="se.example.phoneclient.MyConnectionService"
        android:label="@string/MyConnectionService"
        android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">
        <intent-filter>
            <action android:name="android.telecom.ConnectionService" />
        </intent-filter>
    </service>

UPDATE: Solved Phone accounts using the PhoneAccount.CAPABILITY_CONNECTION_MANAGER does bind automatically, despite the documentation says it wont. This means that you don't have to worry about selecting phone accounts at all. Please keep in mind that this might change, since the documentation says otherwise.

Community
  • 1
  • 1
ProfessorChaos
  • 201
  • 3
  • 12
  • 1
    Where have to added the code to register phone account? In the start method of the derived class of ConnectionManager or in the main activity's onCreate method? – BTR Naidu Aug 24 '16 at 09:34
  • What other permissions you had to define in your AndroidManifest.xml? If I move the register phone account code to the onCreate, I get a SecuriyException. – BTR Naidu Aug 24 '16 at 10:18
  • How did you create PhoneAccountHandle? I'm trying to create this, but get SecurityException, when I registerPhoneAccount: Package xxx.xxx... does not belong to 10145... – Rasmus Höglund Nov 08 '16 at 14:44
  • @RasmusHöglund did you ever figure it out? – elcapitan Jun 17 '20 at 18:04

0 Answers0