I want my android app to automatically connect to a paired BlueTooth device as soon as this device is powered on. Right now I do it by checking every second, whether the device is in range or not but I hope there is a better way?
For example, can I register a receiver, which is executed as soon as a Bluetooth device is in range? (like with BluetoothDevice.ACTION_ACL_CONNECTED, but not for the connected-event but for a „in range“ event)
Related
My app is currently in need of a way to know if I could know the users device is currently connected to the any bluetooth device when the application is launched/activity is launched/resumed/paused, Ive tried ACTION_ACL_CONNECTED but it can't check device connection state when the device is already connected before the activity is launched or connected outside the activity
I'm working with a low energy device that can be very finicky with certain android phones and when it doesn't connect after a phone restart I want to either reset the android Bluetooth service(clear it's storage) or ask the user to do so.
Is there any way I can do this?
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.
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.
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?