I need to retrieve the phone number and imei with the cord, I tested some plugins but on my device I'm testing it did not work at all
My device is dual sim and with android 7.1
Is there any way to recover the phone number and imei in both cases?
I need to retrieve the phone number and imei with the cord, I tested some plugins but on my device I'm testing it did not work at all
My device is dual sim and with android 7.1
Is there any way to recover the phone number and imei in both cases?
As requested, the phone number could not recover because sometimes it returns null, but imei's is there:
plugin: link
function errorCallback(error)
{
console.log(error);
}
// Android only: check permission
function hasReadPermission()
{
window.plugins.sim.hasReadPermission(successCallback, errorCallback);
}
// Android only: request permission
function requestReadPermission()
{
window.plugins.sim.requestReadPermission(successCallback, errorCallback);
}
function retImei(callback){
window.plugins.sim.hasReadPermission(
function isAlowed(alowed){
if (alowed != true) {
window.plugins.sim.requestReadPermission(
function returnedAlowed(returned){
if (returned === 'OK'){
window.plugins.sim.getSimInfo(
function getResponse(response){
callback(response.deviceId);
},
errorCallback
);
} else {
throwError('É necessário permitir acesso ao telefone');
}
},
errorCallback
);
} else {
window.plugins.sim.getSimInfo(
function getResponse(response){
callback(response.deviceId);
},
errorCallback
);
}
}, errorCallback);
}
function getImei(){
retImei(function returnImei(returned){
myApp.alert(returned);
})
}