Search code examples
javascriptvue.jsemulationb2gkaios

Why camera in KaiOS emulator (B2G) not working?


I want to make a QR Scan with KaiOS technologies, but that is not working in the KaiOS emulator. I'm using emulator version 2.2. But, I try on the web browser, the camera is worked.


Solution

  • On KaiOS phones, you have to make use of mozActivities like below:

    var cameraActivity = new MozActivity({
        name: "pick",
        data: {
            type: ["image/*"]
        }
    });
    
    cameraActivity.onsuccess = function () {
        console.log('The received photo blob is' + this.result.blob);
    };
    
    cameraActivity.onerror = function () {
        console.error('Unable to open camera from device ');
    };
    

    Kindly refer to this link here for further details.