I am making an Android app that will communicate via Bluetooth with other devices. These devices need to check WiFi hotspot. How can I, from inside the app, check if the phone is an WiFi hotspot?
I don't need to turn hotspot on from the application, just check if it has so I can tell the user to turn it on manually to be able to use the app.
EDIT:
I just realized the question is not really correct.
The phone with the app I am developing connects to internet via wifi. Then it needs to share internet with other devices via Bluetooth. The answers here worked fine to check if WiFi hotspot is on. But I need to check if it can share internet via Bluetooth with other devices.
The phone gets internet via wifi, but the devices have to get internet via Bluetooth.
Related
I am developing an app in which I need to scans WiFi network and display the list of all connected devices.
Allow a use to tap on a device and the app should show all the hardware info of that particular device. Here by hardware I mean - RAM, Storage Media, Storage Capacity, Device Name, Device IP address, etc.
Now this device can be anything like xbox, a laptop with Linux/Windows, mobile phone like iPhone or any Andorid based smart phone or even a printer.
How can I scans WiFi network and query/detect all the devices attached to it?
What are the protocols that I need to use to get list of hardware in a particular device irrespective of the OS running on it?
Check requestPeers of
WifiP2pManager
As per documents it seeks
PeerListListener which returns WifiP2pDeviceList carrying list of WifiP2pDevice which carries deviceAddress, deviceName, primaryDeviceType, secondaryDeviceType, status and other attributes.
Maybe the Network Discovery github project could help you. It lists all users connected to WiFi with IP and MAC addresses and gathers even some information like open ports, device name, ping, etc.
Hope it helps
In my opinion, you can use Wi-Fi Peer-to-Peer
https://developer.android.com/guide/topics/connectivity/wifip2p.html
"Wi-Fi peer-to-peer (P2P) allows Android 4.0 (API level 14) or later devices with the appropriate hardware to connect directly to each other via Wi-Fi without an intermediate access point (Android's Wi-Fi P2P framework complies with the Wi-Fi Alliance's Wi-Fi Directâ„¢ certification program). Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi P2P, then communicate over a speedy connection across distances much longer than a Bluetooth connection. This is useful for applications that share data among users, such as a multiplayer game or a photo sharing application."
Blockquote
Is this possible to detect bluetooth device in web application using java bluetooth library?
As currently I have one button "Detect Device" in jsp page, which use server device's bluetooth and find nearest bluetooth enable devices by using jsr-82 (Bluecove). The issue is its detect bluetooth enable devices nearest to server (as it use server's bluetooth) not from the client device's bluetooth.In my case assume server is laptop as i had run my web app on it now i'm hitting request from another laptop1 than rather than using laptop1's bluetooth it still use server's (laptop) bluetooth to detect bluetooth enable devices.
I'm using Bluecore Library in app.
Any suggestion please
I need a suggestion to implement a bluetooth application:
it scan for devices and have to check if the discovered devices has the same application installed.
There's a way to do that?
From http://developer.android.com/guide/topics/connectivity/bluetooth.html
"a Bluetooth device within the local area will respond to a discovery request only if it is currently enabled to be discoverable. If a device is discoverable, it will respond to the discovery request by sharing some information, such as the device name, *class,* and its unique MAC address. Using this information, the device performing discovery can then choose to initiate a connection to the discovered device.
So i guess the device need to accept the connection to get more information about installed apps and other.
we have two android device A and B on different network and different IPs, we donot know the phone number of device A.Device B want to connect with device A i only know the application ID of the android Device A and Device installed the app and connected to internet. is there any technique to find device A on network through his application iD in a secured way using java language?
Maybe Google Cloud Messaging?
I have enabled wifi through code ...
wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true);
I want to redirect to the Available devices in the wi-fi direct screen. I dont wanna implement my own listview for devices and stuff, as shown in the Wi-fi direct demo on android sdk.
This has been done in an app on PlayStore, where the app redirects to the devices screen and the file transfer begins on selecting a device, just like bluetooth.
Whats the intent for this?
First of all the code you used doesn't start wifi-direct . it starts Legacy-wifi of your device . So unless the wifi-direct is enabled you can't find wifi-direct peers.
You can skip showing the list view if you know which device you want to connect to just connect to it using it's mac, though even in this case you'd have to discover the peers (i.e call discoverPeers() of WifiP2pManager) before you connect to the device by its mac.
Is this what you asked for or something else?