Firstly configure the mobile data APN through the UI and verify that is working.
Next, we will need to configure to MMS APN without using the API. To do this, you will need access to the phone through adb
, and you will need a rooted phone (see other posts on how to do this if you don't already have that). All of the commands could alternatively be performed on the device itself through a shell.
In Android, the different networks that can be configured are identified by a 'subscriber ID' or subId. The first step is to find the correct subId
to use.
If you haven't already, restart adb as root using adb root
.
Now find the subId
already in use for data with:
adb shell content query --uri content://telephony/carriers/preferapn
Look for the part of the line that looks like sub_id=3,
- you may have a different number in place of 3. That is the subId for mobile data - not the one we want to use, but useful for elimination. Also make a note of the _id
number and the numeric
from the response - you will need those in another step.
Run adb logcat -d -e "matching subId"
and look at the subIds that come back. If you only have one SIM enabled, but you need to enable a separate network for MMS, you should see two different numbers in the results. Eliminate the one that matches the mobile data subId. This is the subId you will need to configure (in my case, it is 2).
Now list the options with
adb shell content query --uri content://telephony/carriers/ --where "numeric='50502'"
(replacing 50502
with the numeric you recorded from the earlier query). In the results, find the row that matches the APN you want to configure. In the Optus case, the row will like something like
Row: 5 _id=2912, name=Optus MMS, numeric=50502, mcc=505, mnc=02, apn=mms, user=*,
server=*, password=*, proxy=202.139.83.152, port=8070, mmsproxy=61.88.190.10, mmsport=8070,
mmsc=http://mmsc.optus.com.au:8002/, authtype=-1, type=mms, current=1, protocol=IP,
roaming_protocol=IP, carrier_enabled=1, bearer=0, bearer_bitmask=0, mvno_type=,
mvno_match_data=, sub_id=3, profile_id=0, modem_cognitive=0, max_conns=0, wait_time=0,
max_conns_time=0, mtu=0, edited=0, user_visible=1, user_editable=1
If there are several options and you are not sure which one, you could try each one in turn using the following steps. Note the number after _id=
- that is your APN ID you need to configure.
To configure the MMS APN, use the command
adb shell content insert --uri content://telephony/carriers/preferapn/subId/2 --bind apn_id:l:2912
Replace the 2
with the subId you worked out you needed to configure (i.e. the one that is not the mobile data subId). Replace the 2912
in the above with the apn_id from the above command.
If you configured the APN successfully, you should now be able to send MMS and use mobile data at the same time.