Android Question serial1.address returns wrong value on Android 6

DickD

Active Member
Licensed User
I am trying to get the MacAddress of my phone using serial1.Address. I've tried placing this before and after serial1.Initialize("serial1") and/or before and after serial1.Connect(...). This works just fine on an Android 4.4 phone but on Android 6 it returns the address 02:00:00:00:00:00. How do I get the MacAddress of an And. 6 phone?
 

DonManfred

Expert
Licensed User
Longtime User
Android 6 does not provide the Mac anymore.
Search Androids developer site or the forum. this has been asked a few times.
 
Upvote 0

DickD

Active Member
Licensed User
Android 6 does not provide the Mac anymore.
Search Androids developer site or the forum. this has been asked a few times.
I found Erel's code below in another thread to get the MacAddress but I can't get it to work. I get the following error message:
java.lang.RuntimeException: Method: getWifiMacAddress not found in: b4a.example.chatactivity

B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim jo As JavaObject = Me
Log(jo.RunMethod("getWifiMacAddress", Null))
 
Upvote 0

DickD

Active Member
Licensed User
Android 6 does not provide the Mac anymore.
Search Androids developer site or the forum. this has been asked a few times.
I guess I also have to incorporate the Java code from Erel's example into my Activity but I don't know how to do that.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top