How do you read phone's mac address when button click?

I am creating a panic button, then the need is ... to get the phone´s Mac Adress in order to tell the users who pushed the button.
I wonder, is there a way to get the device´s mac address
If it is so... I would have my issue solved, then I can tell in the SMS that I will send, the phone number that activated it.
Tks in advance to all of you guys.


Estoy creando un boton de panico, y si pudiera obtener la direction Mac del telefono que lo presionó, yo podria identificarlo e informar a los usuarios del boton de panico, quien fue el queue lo activó.
¿Alguien sabe como poder obtener la MAC cuando see presione el boton?
Solo la instruction clave seria la gran solucion para mi.

Greetings to all of you y saludos a los amigos queue hablan español.

Rafael

1 Like

Try https://puravidaapps.com/wifi.php which is an extension

2 Likes

Actually Rafael, why would you need the phone's Mac Address, which is tied to the WiFi network? The User of your app can input their phone number or the App could use Taifun's telephony extension to get the phone number.

https://puravidaapps.com/telephonymanager.php

You can use App Inventor's Contact Picker such that the User can select which contacts an emergency SMS would be sent to. Be aware that if the App is to be distributed via Google Play, you cannot send an SMS directly, your App must instead pass the SMS to the phone's default Messenger - this is a recent Google Android Security Measure.

Hello ChrisWard

In order to create the panic button, I need no extra action from the user. Only push the button, and let actions do what they should do.

In this requirement, I am looking for the Phone´s Mac Adress in order to get an unic number that may tell the other panic user to get to know who pushed the button.

So the phone´s Mac Adress seems to be that unique number that I can compare, then let the user get to know who did get panic.

This is why dear ChrisWard.

Thanks in advance, if you may help.

Rafael

Tks a lot Seve I will try this, and if it works, I will put the code here.
So kind of you.
Best regards
Rafael

Tks a lot dear ChrisWard.
The Idea that you gave me "Taifun's telephony extension to get the phone number." is simpler and gave me an easier solution and I really appreciate your kind reply and motivational effort to help me out.

Wish you all the best. Tks.

Rafael

Hello ChrisWard
I was using the examples and the extension you told me to use, does not get my Phone number.
I have a dual-band Samsung phone.
So, do you have any other way to get the phone number?

Please let me know
Best regards

Rafael

Hi Rafael

The extension is very reliable. So:

  1. What is the model of your Samsung
  2. What version of Android is it running?

I will assign your Forum Topic to my colleague Taifun, the developer of the extension.

from the documentation at App Inventor Extensions: Telephony Manager | Pura Vida Apps

Note: This is no guaranteed solution, because the phone number is not physically stored on all SIM-cards, or broadcasted from the network to the phone. This is especially true in some countries which requires physical address verification, with number assignment only happening afterwards. As workaround you always can use this solution.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hi again Rafael

I would:

Use the Extension - if no number found:
Use the work around - if no success
Ask the User to input the number.

This would be on installation, the very first time the App is started. Once the phone number is obtained, save it in a TinyDB for subsequent use of the App, but provide a facility for the User to edit, should the number change.

Dear CrisWar, here are the requested answers. (See below, please)

See my previous reply Rafael.

bonsoir Rafael je vous écris pour vous demandez si vous avez réussit a récupérer l'adresse mac d'un téléphone en cliquant sur un bouton. si oui bien vouloir m'envoyez le code source de l'application en question.

I am facing a similar issue, but have a problem with the Wifi extension from @Taifun

The mac address being returned by TaiFunWifi1.MacAddress is 02:00:00:00:00:00
In the phone status information the Phone Wi-Fi MAC Address is 3C:29:4E:a0:1B:16

Any suggestions to retrieve the correct Phone Wifi MAC would be welcome.

Android version 11, Galaxy A12

You can no longer get the hardware MAC address of a android device. WifiInfo.getMacAddress() and BluetoothAdapter.getAddress() methods will return 02:00:00:00:00:00. This restriction was introduced in Android 6.0.

There seems to be a workaround available, which still might work for some devices, see the comments here

Taifun

@Taifun thank you for the information. My issue is that I need to save a configuration onto 100's of devices and the configuration files are different for each device. I need a way to ensure that the correct configuration is being applied to a particular device. Any ideas how can I identify the device ?

you might want to try

Taifun

1 Like