optimalstrategy / sms_forwarder_app

An app for forwarding SMS messages
MIT License
55 stars 18 forks source link

Dual SIM cards, forward the SIM card slot number #18

Open Opsmers opened 2 years ago

Opsmers commented 2 years ago

@optimalstrategy Dear Sir,

In the case of Dual SIM cards, whether It can forward the data with the SIM card slot number or the remarks in SIM card slot management?

Thanks a lot!

optimalstrategy commented 2 years ago

Hi @Opsmers,

At the moment, there's no way to choose which messages are forwarded. I've had plans to implement some kind of filtering system for a year this point, but there's nothing ready to be released yet.

This feature request probably belongs to #4, but I'll keep the issue open in case if you'd like to be notified when the feature gets implemented.

TheYarin commented 2 years ago

@optimalstrategy I think @Opsmers just wanted the SIM card slot number to be mentioned in the message that's forwarded, not to forward only messages from a certain SIM card.

BTW @optimalstrategy, thank you so much for building this project! I tested it and it looks great! I'll use it in the future when I travel abroad, so I can continue receiving SMS messages. Thank you for sharing this with the world ❤

TheYarin commented 2 years ago

I looked into this and the underlying Telephony package does not expose this data, so this will be difficult. This is the best info I found in this regard: https://stackoverflow.com/questions/35968766/how-to-figure-out-which-sim-received-sms-in-dual-sim-android-device

optimalstrategy commented 2 years ago

@TheYarin Thanks for using my app and investigating the issue.

I don't think there's a way to get the sim index without switching to another library, re-implementing the SMS receival functionality from scratch, or PRing telephony to include the slot ID with the messages. The latter should be possible without breaking the API compatibility since telephony uses an SmsMessage newtype. However, its maintainer appears to be unresponsive at the moment, so I'll probably need to fork the project and depend on my fork's git URL.

I don't have a lot of time at the moment, but I'll see if I can hack something together in an hour or two.

EDIT: After further investigation, I think it might be possible to list the available sim cards using another library and compare their subscriptionId with the ID on each SMS message.

EDIT 2: Telephony doesn't extract subscriptionId when parsing messages, so forking it is required. I've tried patching the library to do that, but my phone and emulator don't provide a subscriptionId, likely because they're single sim, and I don't have a dual sim phone to test on.

devoicy commented 1 year ago

getDefaultSmsSubscriptionId 🤔

bilogic commented 1 year ago

this will be a GREAT to have!