6

I am setting the phone app as my default app and also getting the call inside the onCallAdded() method. but while incoming the call, should open android phone dialer, not my default dialer, like truecaller or easycallbalcklist

Service class

 public class TestConnectionService extends InCallService {
@Override
public void onCallAdded(Call call) {
    super.onCallAdded(call);
    Log.d("callservice","call came");
    }
}

MainActivity class

 public class MainActivity extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
    intent.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getPackageName());
    startActivity(intent);
    }
}

mainfest.xml

<service
        android:name=".service.TestConnectionService"
        android:permission="android.permission.BIND_INCALL_SERVICE">
        <meta-data
            android:name="android.telecom.IN_CALL_SERVICE_UI"
            android:value="true" />

        <intent-filter>
            <action android:name="android.telecom.InCallService" />
        </intent-filter>
    </service>
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • not sure what you're asking. if you set yourself as the default phone app *AND* implement InCallService then you're now in charge of displaying the in-call-ui, including the in-call-ui's dialer – marmor Aug 09 '18 at 21:14
  • thanks for reply, i am agree with you, if i set the app as phone app default and implement inCallService then i have to show in-call-ui, now is it possible to show phone app dilaer while incoming call arrive on mobile, instead of showing my call-ui layout. – Dhananjay Gupta Aug 10 '18 at 03:55
  • I have the same problem, did you fix it? – why_rookie Feb 21 '20 at 06:54
  • did you find the solution? – Vladimir Fisher Mar 26 '21 at 08:06

0 Answers0