Scan WiFi MAC addresses of mobile phones from java application - java

My application (not mobile application) needs to scan WiFi MAC addresses of mobile phones that are in my range.
For now I can only test it with my laptop. So I would like to connect my wireless card in laptop with my java application so application could scan for addresses. In near future, I will connect my application with different WiFi detector.
My WiFi card is Intel(R) PRO/Wireless 3945ABG Network Connection
Stackoverflow and google only shows results for android mobile development.
What API can you recommend?

This is tricky and maybe impossible, depending on precisely what you want - feel free to view this as a list of warnings or starting points, depending on how brave you feel :)
to obtain MAC addresses you need to capture raw packets, which isn't possible using pure Java; you'll need to use something like jNetPcap which wraps the (native) libpcap packet sniffing library
to determine whether a MAC address is likely to belong to a mobile phone, you'll need the list of Organizationally Unique Identifiers which links the first three bytes of a MAC address with the device manufacturer; mind that the OUI list might not be sufficient, since Apple (for instance) makes phones and other devices
to see all wireless traffic you'll need a driver that supports putting the wifi interface into monitor mode - these don't exist for all platforms/devices
the devices may not be sending any data...

Related

Get the MAC address of bluetooth adapter in Android

I'm trying to get the MAC address of bluetooth in my android device. So I'm using the following method:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
String macAddress = mBluetoothAdapter.getAddress();
The address returned is 02:00:00:00:00:00. I've seen questions and posts saying that it's not possible anymore to get your MAC address in android unless your application is a System Application.
So what if I really need to get the MAC address of my phone?? It's impossible to do it or what?
Note: I know this question is asked lots of times on SO, but most of the answers are out of date.
For security reasons this functionality is not available on Android since Android version 6.0 [source]:-
To provide users with greater data protection, starting in this
release, Android removes programmatic access to the device’s local
hardware identifier for apps using the Wi-Fi and Bluetooth APIs. The
WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods
now return a constant value of 02:00:00:00:00:00.
The reason for this is to stop random applications gaining information about the phone's hardware addresses therefore violating the privacy/data protection.
I hope this helps.
What Youssif Saeed said in the other answer was correct. Android won't let us get the MAC address anymore.
Brief description about what I want:
Let's say I have a phone with MAC Address X, and I have another nearby device with MAC address B. When the two devices are nearby each other. I was able to get the MAC address of the other device using BluetoothDevice and getAddress() method from ScanResult.getDevice(). So what I still need is to catch my own device MAC address so that in the backend I save each user with his MAC address, and when I catch it in bluetooth, I know who's nearby me
Here's the workaround I've done in order to send some data between near devices.
I found something called Nearby Messages API. It is available for Android and iOS and very easy to implement. Now I'm able to catch near devices with my application installed on them, and send a unique Id generated by the application to identify the user.

Remote monitoring system for CAPD

I know there are devices out there that monitors i.e. glucose of a CAPD patient. My question is do you know if I can read/access those data? I'm planning to create an Android app that read those data but I am hitting a wall as I dont know other devices.
You can read data off many medical devices, BUT the interfaces differ and the communication protocols also differ, AND not all devices support outside data collection. You will have to go device by device and write a device driver for each.
Kind of like you PC printer. Can they communicate with PC? Of course they can - but some connect over USB, some over PS2, some over LAN, some over Wifi, AND almost all of them require a device driver to 'talk'.

Looking for options for a cross platform mobile app to communicate with a micro-controller

I have written a Java SE desktop application that communicates with a micro-controller. It displays data received from it and send updates to it, communicating constantly. It uses some third party libraries and the javax.comm library to communicate over serial. We are currently investigating our options for developing a cross platform mobile app that has the same functionality. Ultimately, this new application would be able to be compiled and run from the desktop, a mobile phone and a tablet. I have researched a few options (Oracle's new ADF mobile, phoneGap, Java ME, etc.) but am wondering if anyone has any suggestions of what would be best. Feel free to ask any follow up questions. Thanks in advance.
Ray
You are going to run into a couple challenges in doing this. First of all, any cross-platform framework is almost immediately out. Because of the significant differences outlined below, no framework I'm aware of has support for hardware connectivity.
Hardware
Your embedded device is currently communicating with a PC using RS-232 (UART). This is a hardware interface that is not present on any consumer mobile devices (except the iPhone, but we'll get there). The only common interfaces between all the major devices platforms (iOS, Android, Windows Phone) that support a point to point connection from a hardware perspective are USB and Bluetooth.
Of the two, Bluetooth is the simpler one to adapt onto your embedded device because there are numerous Bluetooth modems on the market that simply attach to a UART and relay data over the link as a wire replacement using the RFCOMM protocol.
SDK Support (i.e. how can an APP talk to this hardware?)
The Android SDK supports communication between an application and both interfaces. Bluetooth came about in Android 2.0, and USB in Android 3.1.
The iOS SDK supports communication with both since iOS 3.0. It also supports Bluetooth LE as of iOS 5.
The Windows Phone 8 SDK claims it will support Bluetooth connections, no word that I know of on USB support.
Licensing
This one really only applies to iOS, but it applies to both Bluetooth and USB/Serial. In order to develop the hardware side of the iOS connection, you must be a member of their Made For iPod program. Membership is free, but requires a significant amount of paperwork, and this really only gets you access to the documentation required to implement the protocols required by their proprietary connector. Obtaining the connectors and other components required to make actual connection require further approvals that are not easy to obtain.
Bluetooth LE is the only connectivity standard on iOS that does not require membership in MFi to implement on both the hardware and software sides. However, to date no other major mobile SDK supports this interface directly (Android is getting there).
Overall, my recommendation would be to lean towards adding Bluetooth and keep a close eye on the Bluetooth LE space. If you can find an embedded module that runs dual mode, you can run LE to iOS devices and standard Bluetooth to other platforms. This is the only license-free path I can think of, and as Bluetooth LE SDK support improves, the other devices can take advantage of that as well.
Based on your tags, I presume "cross-platform" really just means android & iOS? That said, the question which cross-platform tool to chose has been answered quite a few times here, and doesn't really bear repeating. My recommendation is to go native, unless you really don't care about performance and optimal solutions.
That said, the interface to the hardware should be interesting. Android has the Open Accessory Protocol which is compatible with more recent versions of Android. This is for connections over USB. Apple is considerably more closed and requires licensing fees for the protocol, the connectors, etc. Your best bet would be to go with bluetooth or even wifi to interface your hardware to the mobile device. This would require only a single hardware design for both devices and would be somewhat future-proof as well.

Control a desktop application using an android phone

I want to build an application where an android phone would control a desktop application.
I only need to send coordinates from the phone to the desktop when user's finger is on the phone screen.
But I am kinda confused on the networking side if i should use bluetooth, usb, or wifi (intranet).
I did some research on bluetooth, doing bluetooth socket programming on an android phone shouldn't be a problem, but on the desktop side there are only a few free SDK/library. any suggestion on what to use?
If I were to use USB/cable, What API on the android side I need to use?
I am actually more familiar with general socket programming (wifi), but I think it's going to be slow (correct me if Im wrong) so this would be my last option.
PS: I am using Java for the desktop application too
any suggestions on what method to use? or even maybe I should use .net on the desktop side?
Thanks
You might find the open source RemoteDroid app to be useful in creating your app. It may even do everything that you want.
The source code is here. You may need an svn client like TortoiseSVN in order to download it.
Wifi is probably the most supportable.
Bluetooth requires hardware and drivers on the PC side
USB would ordinarily seem like the most sensible if the wire isn't a problem, but the catch is that it requires that the user enable "USB debugging" on the phone, and have either the android SDK or equivalent functionality to the adb forward command installed, plus a compatible USB driver for the phone. If all that were the case, you'd just forward a port from the PC to the phone and have a pc program connect to that port on the loopback interface which will be forwarded to a service running on the phone.
It's possible you could do something piggybacked on the USB tethering capability of more recent releases to get you a network-over-usb that you could use to connect programs on the PC and phone, but you'd need modified PC drivers so that you don't actually push the PC's internet traffic through the phone (unless you mean to tether as well).

How to interoperate between PC and camera from cell phone

My new project is to build an application to use the cell phone camera as the main camera from my PC.
How can I do this kind of stuff?
I thought of using bluetooth, but how my PC define the cell phone as the main camera?
Best reguards.
Depending on the camera phone and its features, you can do it. For my Bluetooth efforts, I've been using A7 hardware and a .NET library Blue Tools from Franson.
I've been able to:
pair devices in code
send/push images to the phone (probably the reverse would work, but I didn't try)
discover devices automagically
serial comm
network com
install as a network driver
Well on the Bluetooth side of things you might need a program running on you phone to forward the images. Or you might find that there's a Bluetooth program already running and providing that service, for instance the Bluetooth BASIC IMAGING PROFILE (BIP) (1) profile includes the usage scenario: "Use of a mobile phone to control the shutter of a digital still camera and immediately examine the result on the phone’s screen. In the present scenario, any other portable imaging device could play the role of the mobile phone."
So first you need to find if the phone supports BIP. You could for instance use the SdpBrowser sample application in my 32feet.NET .NET Bluetooth library to see what services the phone is advertising. Otherwise perhaps its documentation will tell you. You'd then have to find out whether the BIP service on your phone supports that scenario.
On the PC side you might need some driver level software to allow any application to use the remote camera. You might start by just allowing your own application alone to use the camera.

Categories

Resources