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>