android - Get Phone Number of real device -
i need help. need take phonenumber of device . iam using cordova-plugin-sim. heres code
this.sim.getsiminfo().then( (info) => browser.on(“loadstop”) .subscribe( () => { console.log(info.phonenumber); alert(info.phonenumber+’ '+info.cards[0].phonenumber); }, err => { console.log("inappbrowser loadstart event error: " + err); }), (err) => console.log('unable sim info: ', err) );
but had problem. in emulator work great, on real device had undefind when try outpu phonenumber? other parameters work great. problem? ask permissions on start of app
this.sim.hasreadpermission().then( (info) => console.log('has permission: ', info) ); this.sim.requestreadpermission().then( () => console.log('permission granted'), () => console.log('permission denied') );
Comments
Post a Comment