android-studiosmsmanager

Sms manager getSmsManagerForSubscriptionId


I set my app to use subscription id of 1 always when sending sms request received from server, the app is working perfectly in background but whenever it is running in the foreground it pop up dialog screen to select sim for sending the sms. Please what is going wrong?

private void sendSms(String to, String msg, String oId) {
    SmsManager sms = SmsManager.getSmsManagerForSubscriptionId(1);

    sms.sendTextMessage(to, null, msg,
            null, null);
    smsCallback(oId);
    Log.d(TAG, "smsCallback ID: "+oId);
}

Solution

  • I now understand that the subscription ID is wrong. Found the correct subscription ID and the issue is resolved.