WebAPI/WebIccManager/Multi-SIM: Difference between revisions

Jump to navigation Jump to search
Line 115: Line 115:


==== Icc Object Life Cycle ====
==== 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.
Icc object only be created when corresponding icc is detected by system. And becomes invalid after it can not be detected by system.
* You can use IccManager to monitor this.
* You can use IccManager to monitor this.
     var iccManager = navigator.mozIccManager;
     var iccManager = navigator.mozIccManager;
Line 129: Line 129:
     }
     }


* If you already hold a reference for a specific icc object, you still can know it becomes to invalid via cardState or iccInfo.
* If you already hold a reference for a specific icc object, you can monitor this via cardState or iccInfo.
     var icc = iccManager.getIccById(iccId);
     var icc = iccManager.getIccById(iccId);
      
      
     icc.oncardstatechange = function () {
     icc.oncardstatechange = function () {
       if (icc.cardState === null) {
       if (icc.cardState === null) {
           // System can not detect this icc any more, this icc object becomes to invalid.
           // System can not detect this icc any more, this icc object becomes invalid.
       }
       }
     }
     }
Line 140: Line 140:
     icc.oniccinfochange = function () {
     icc.oniccinfochange = function () {
       if (icc.iccInfo === null) {
       if (icc.iccInfo === null) {
           // System can not detect this icc any more, this icc object becomes to invalid.
           // System can not detect this icc any more, this icc object becomes invalid.
       }
       }
     }
     }
Confirmed users
258

edits

Navigation menu