how do i get the MAC address of a device? uid.MAC is not working, it is returning null value
please help
Device is never null.
If you run ionic emulate browser you will get
cordova:“4.1.0”
isVirtual:null
manufacturer:“unknown”
model:“Chrome”
platform:“browser”
serial:“unknown”
uuid:null
version:"58.0.3029.110
Native plugin only works when using cordova (i.e. executing on a platform: ios, android, browser). But when you only uses the webview ionic serve then plugins are empty objects:
cordova:null
isVirtual:null
manufacturer:null
model:null
platform:null
serial:null
uuid:null
version:null
i am testing from a mobile phone, perhaps i am doing something wrong but i am still getting null for the mac address
and i wrote only this in my code
alert('Mac add is '+uid.MAC);
i’m sure that i am missing something
Do you allow permission to access your information device?
no hasn’t set any permission, where should i set it?
When do you run app his open alert to accept native function.
no none of this has been done
So… Post your code.
i have try this
async getImei() {
const { hasPermission } = await this.androidPermissions.checkPermission(
this.androidPermissions.PERMISSION.READ_PHONE_STATE
);
if (!hasPermission) {
const result = await this.androidPermissions.requestPermission(
this.androidPermissions.PERMISSION.READ_PHONE_STATE
);
alert('new kind of test '+this.uid.MAC);
if (!result.hasPermission) {
throw new Error('Permissions required');
}
alert('new kind of test '+this.uid.MAC);
// ok, a user gave us permission, we can get him identifiers after restart app
return;
}
alert('new kind of test '+this.uid.MAC);
return this.uid.MAC
}
still no results
did you found a solution my app is blocked on this problem
what do u mean ?
did u found something