My code successfully sends MMS. The approach uses ConnectivityManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
NetworkRequest networkRequest = builder.build();
cm.requestNetwork(networkRequest, new ConnectivityManager.NetworkCallback()
{
@Override
public void onAvailable(Network network)
{
super.onAvailable(network);
// do MMS sending here using HTTP/network APIs
cm.unregisterNetworkCallback(this);
}
});
}
In a dual SIM phone, this approach seems to pick a default SIM and send MMS out of that number (I am not sure how the default is picked).
How does one specify a SIM slot or a Subscription ID as part of the NetworkRequest? Or is there another way?
Just a reiterate this question is only about MMS, not SMS. Also, the question is not about sending MMS programmatically (that is discussed elsewhere in SO). The question is specific to dual SIM devices.
Thank you
You can get sim info by below method