In the project I am working on now, it is necessary to change Bluetooth (in Android phone) from master to slave.
How can I make this possible?
Let me know if you know how to switch from master to slave!
I tried nRF app but I don't know how to do it exactly.
I can't find any possible way about this.
Assuming that you're talking about Bluetooth Low Energy (since you mention nRF app), you cannot just switch from master to slave. Your entire code has to be written as a master (in your case this is probably a central with a GATT client) or a slave (in your case this is probably a peripheral with a GATT server). Have a look at the links below for more information:-
Android BLE central (GATT client) implementation
The ultimate guide to Android BLE
Making Android BLE work
Android BLE central example
Bluetooth Low Energy on Android
Android BLE peripheral (GATT server) implementation
How to advertise Android as a BLE peripheral
Android BLE peripheral example
Bluetooth GATT server example
Using a GATT server
Generic BLE information
Bluetooth Low Energy: A primer
Getting started with BLE
Introduction to BLE GATT
Related
I am creating an android App that acts as a peripheral and sends out a Bluetooth Low energy advertisement. I am using BluetoothGattServer to set up a server for a client device to connect. My main goal is to read an RSSI value from the client. Is it possible for me to use the BluetoothGattCallback as opposed to BluetoothGattServerCallback with the BluetoothGattServer so that i can implement and use readRemoteRssi?
BluetoothGattCallback is related to to a Master
so you wont be able to use it if your phone is acting as a server/slave
Is there any way to make a communication between a peripheral with android OS with RS232 support and a non android smart TV with RS232 support? Basically, I have to create an app which will be installed on the android based peripheral so that when it is connected to the TV using single RS232 cable, commands could be sent from peripheral to TV.
I have not been able to proceed because I am unable to find a process for that.
From what I understand, in stock Android unless you are doing something special in NDK (C code) with specific hardware there isn't a serial connector.
Android Things has a UART but that is specific to Android Things hardware.
If you are trying to get a off-the shelf phone/tablet to connect via serial, a USB-serial dongle would probably be the quickest route.
See: Communicating with serial USB device over Android
Since the microUSB connector will be occupied you can run adb over Wifi. See: Run/install/debug Android applications over Wi-Fi
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
I am working on a project where I have to connect my android device (LG G3) to a GPS with usb. I can't figure out how I can get the data out of my GPS and I do not want to use the device it's internall GPS because I need to be pretty accurate.
If you want to program your own USB GPS to Android, you can take a look at USB Host
According to USB Host documentation:
When your Android-powered device is in USB host mode, it acts as the
USB host, powers the bus, and enumerates connected USB devices. USB
host mode is supported in Android 3.1 and higher.
To use an USB external GPS you have to enable Android developer Options on your phone and enable using mock locations so the service (your one or a third party one) can send locations to the system "bypassing" the internal location system.
There are several apps that can transfer GPS data to your application (take a look at Your are here GPS for example. This app also lets you wath NMEA data).
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.