1. I have tried all of the stack overflow solutions but it didn't work, all solutions are outdated
  2. I tried both below codes but it always return the -1

int slot = intent.getExtras().getInt("slot",-1)

int slot = intent.getExtras().getInt("simId", -1)


Solution 1: Tariq Hussain

val accounts = telecomManager.callCapablePhoneAccounts

if (accounts.size > 1) {

            accounts.forEachIndexed { index, account ->
                if (account == CallManager.call.last()?.details?.accountHandle) {

                    val phoneAccount = telecomManager.getPhoneAccount(account)
                    val label = phoneAccount.label.toString()

                    val img: Drawable =
                        resources.getDrawable(sims[index], theme)

}

Try using this method with telecomManager you can find the sim on which you are receiving call.