Can anyone explain to me how to get the device's IMEI number from Phonegap? I am using the IMEI plugin in my app it is not showing anything.
To install, I have tried both:
phonegap plugin add https://github.com/zho/phonegap-imeiplugin.git
-- OR --
cordova plugin add imeiplugin
Example Usage:
window.plugins.imeiplugin.getImei(callback);
function callback(imei) {
console.log("My Android IMEI :" + imei);
I want the output to be displayed when user opens the app, but it is not showing.
here is the solution that how can you use imeiplugin Index.html
<!DOCTYPE html>
<html>
<body>
<h1 id="demo"></h1>
<script type="text/javascript" src="cordova.js"></script>
<script src="js/index.js"></script>
<script> app.initialize(); </script>
</body>
</html>
Index.js
var app = {
// Application Constructor
initialize: function () {
app.bindEvents();
},
bindEvents: function () {
document.addEventListener('deviceready', app.onDeviceReady, false);
},
onDeviceReady: function () {
window.plugins.imeiplugin.getImei(callback);
}
};
function callback(imei) {
var element=document.getElementById("demo");
element.value=imei;
}