Starting on API Level 22, there is native support in Android for Dual-SIM devices. At the center of the APIs, there is SubscriptionInfo.getSubscriptionId().
Using these IDs, you can retrieve SmsManagers for each respective SIM card to send SMS and MMS. You can also identify through which SIM card an SMS was received on the SMS_RECEIVED_ACTION, and so on.
However, what is the lifetime of a Subscription ID? Can I store a Subscription ID in a local database and count on it to still be valid and pointing to the same SIM card later? By later, I mean after rebooting the device, removing its SIM card and popping it back in, or even after factory resetting the device.