WebAPI/WebIccManager/Multi-SIM: Difference between revisions

Jump to navigation Jump to search
Line 111: Line 111:
      
      
     icc.cardState;
     icc.cardState;
==== Icc Object Life Cycle ====
Icc object only be created when corresponding icc is detected by system. And becomes invalid after the it can not be detected by system any more.
* You can use IccManager to monitor this.
    var iccManager = navigator.mozIccManager;
    iccManager.oniccdetected = function (evt) {
        var iccId = evt.iccId;
        // A new icc is detected by device.
        // You can use this iccId to get icc object from iccManager.
    }
   
    iccManager.oniccundetected = function (evt) {
        var iccId = evt.iccId;
        // An icc becomes undetected.
    }
* If you already hold a reference for a specific icc object, you still can know this via it's cardState or iccInfo.
    var icc = iccManager.getIccById(iccId);
   
    icc.oncardstatechange = function () {
      if (icc.cardState === null) {
          // System can not detect this icc any more, this icc object becomes to invalid.
      }
    }
   
    icc.oniccinfochange = function () {
      if (icc.iccInfo === null) {
          // System can not detect this icc any more, this icc object becomes to invalid.
      }
    }


=== Implementation ===
=== Implementation ===
Confirmed users
258

edits

Navigation menu