The SMS app will never have window.Telephony helper so this is dead code. You want the Dialer app to send the cardIndex it wants to use.