*Current B2G (Single SIM)
...
var conn = window.navigator.mozMobileConnection;
if (conn) {
conn.addEventListener('voicechange', this);
conn.addEventListener('datachange', this);
...
*Multi-SIMs
// Listen connection status of default SIM slot
var conn = window.navigator.mozMobileConnectionManager.defaultMobileConnection;
// Listen connection status of specific SIM slot
var conn = window.navigator.mozMobileConnectionManager.MobileConnections[index];
Once the mobile connection object is obtained, the follow work is the same. We can get notification when voice/data connection change occurs in specific SIM.
...
var conn = window.navigator.mozMobileConnectionManager.defaultMobileConnection;
if (conn) {
conn.addEventListener('voicechange', this);
conn.onvoicechange = function onvoicechange() {
...
}
conn.addEventListener('datachange', this);
conn.ondatachange = function ondatachange() { ... } }
==== Get ICC Status ====