I want to simulate a Bluetooth headset being connected to a phone, to see how my code reacts to the intents and the connection as a whole. I'm testing on a real device connected via USB, in Eclipse.
I have been able to simulate the pressing of a "media button" by running the following:
adb shell input keyevent <keycode>
I was hoping for something similar, where I can set the device name, device class etc and trigger it?
Running the following produces instructions on various calls that can be made to adb:
adb shell am start
The way to trigger an intent "ACL_CONNECTED" is by typing this:
adb shell am broadcast -a android.bluetooth.adapter.action.ACL_CONNECTED
further options can be added in the command, as per the instructions from above.
The problem is, I want to simulate all the functionality of a Bluetooth device, not just the few intents it triggers. In other words, I want a dummy Bluetooth device which is indistinguishable from a real device from the phone's point of view.
Related
So i lost my bluetooth ear buds and wonder if there is any way i can see where i was lastly connected to them. I had already tried using command adb shell dumpsys bluetooth_manager but the command only showed bluetooth devices from this day. Is there any command that can show at least 3 days back?
I have an Android TV for which I want to turn the display on and off based on a motion sensor. I have connected the tv to a raspberry pi via Wifi and I'm trying now via adb commands to turn off the display of the Android TV.
As far as I've seen, I need to execute the following command:
./adb shell input keyevent 26
Unfortunately, this also turns down the device and most importantly Wifi. After this the TV is offline and not reachable anymore via the IP address. So I have to use the remote to turn it on again.
So I need a way to keep the Wifi active. I've already tried the following commands without luck:
adb shell svc power stayon true
adb shell settings put global stay_on_while_plugged_in 3
I've also sideloaded a Wakelock app, but that also didn't work. After keyevent 26, the device is always offline.
The TV is a TCL 43P615.
Any ideas how I could achieve this?
Thanks
There would not be a standard way of turning off the screen (https://support.google.com/androidtv/thread/58069060/is-it-possible-to-turn-screen-off?hl=en-GB) but perhaps your TV provides one in settings or eco-mode.
Perhaps you best bet is to disable the screensaver and create a completely black fullscreen Activity that you can start and stop from adb.
As the title suggests, I would like to analyze the bluetooth traffic of my android device on wireshark, I was able to do that just a few hours ago by just connecting the Android device via usb and opening up wireshark, the android bluetooth interface would just shouw up and worked perfectly, after some time (I rebooted the phone and did a couple other things), the bluetooth interface was gone. I'm now able to only access the phone Logcat.
I think I disabled something, or have to do some steps in order to activate this feature, that I had activated before without knowing, but I can't seem to replicate that, and the only things I find online are about saving HCI log in a file and then analyzing them on wireshark, which is not ehat I'm looking for right now
I too was looking for a way to do this and I think the best way I've found so far is to use wireshark's androiddump tool: https://www.wireshark.org/docs/man-pages/androiddump.html
It's built in with wireshark and if your phone is plugged in with adb installed and configured correctly so that you can do an adb shell from your computer, then when you open wireshark your android's bluetooth interface should show up as possible source of capture as soon as you open wireshark.
You were probably using Wireshark extcap androiddump option which has three requirements:
rooted device
developer option Bluetooth HCI snoop enabled
adb server running
From your description, you simply opened wireshark and did not start Android server
Please do the following:
enable developer option Bluetooth HCI snoop - you can do so by
tapping your device serial number in your settings menu
From your terminal execute the following command: $adb start-server when you are finished you can use $adb kill-server
I have a tablet connected to my home automation system. I would like my tablet to open an app when specific conditions are met.
My idea was to install some sort of SSH server on the tablet. When my server wants the tablet to open the App, it logins into the tablet and executes a command turn on the display and open the App.
In theory this works but I haven't been able to find any documentation on the web on how to do this.
I've got as far as installing SSHDroid however when the tablet locks, the SSH disconnects. I'm also unable to find any commands which turn on the display and open apps.
From a computer, if you have USB access already (no root required), check this answer more details.
Connect your tablet with computer(has adb installed) and run
adb tcpip 5555
Then you can control your tablet over wifi by run
adb connect 192.168.0.101:5555 // you can use port forward in you gateway to enable you connect over internet.
Now after connected with tablet you are able to use adb shell commands.
Turn Screen On
adb shell input keyevent KEYCODE_POWER
Start an Application
adb shell am start -n com.package.name/com.package.name.ActivityName
I started to investigate how to send via Wifi some commands to control an android device (Nexus 7 - rooted). So I created an UDP Server app in Android that simulates some buttons through KeyEvent class (for the moment I'm trying to send UDP messages from PC via Wifi to test).
The problem is that it only works within the app, if I open Google Music and I simulate increase volume the app close due to INJECT_EVENTS Permissions.
So at this point I need some ideas to proceed with this project and these are my different options:
Continue with Wifi communication and try to create a service able to skip system permission to simulate all Android buttons I want.
Try BT communication - maybe there is a way to communicate directly to the OS instead through an app.
Try USB communication - I know that through adb shell commands you can simulate all the buttons but...Is it possible to send adb commands from an arduino? Should it be only through USB or could it be via Wifi?
I'm avoiding Tasker/Autoshare solution as it's very slow for what I need.