About ERPNext mobile app,Can I call the function of the cordova plugin in doctype.js?

This is a requirement that needs to be implemented on an Android phone.
I need to use the abc.js function under Doctype to call the scan code plug-in function in cordova to scan the QR code. Is it feasible?
Thank you.

I tested successfully.
1.frappe/public/js/frappe/desk.js +447 (example: redirect_to_login), Add “mobile_to_scanner: function() {},”
2. The js file under Doctype:
$(“div[data-fieldname=‘scanner_btn’]”).on(‘click’,function(){
var test = frappe.app.mobile_to_scanner();
console.log(test);
});
3.erpnext mobile app, mobile-master/www/js/desk.js +90 (eg: redirect_to_login)
frappe.app.mobile_to_scanner = function() {
//cordova code
return “frappe.app.mobile_to_scanner”;
}

1 Like