ADB command to launch screensaver activity - android

I'm turning crazy finding the way to launch the screensaver activity that can be launched from Settings > Display > Screensaver. I want to simulate from ADB clicking on the option "start now" inside the screensaver options because I need to configure some TV's to quickly launch the screensaver on demand.
I have all of them connected through Intel sticks using Android x86 Nougat stable, I can do adb through wifi without issues and I even installed Simple SSH to access through SSH in case of needed.
The keyevents are working, but there is no keyevent to launch the screensaver, only to simulate the power off button, which causes the wireless connection to go down no matter what is configured in the sleep / battery saving settings.
Is there any chance to fix this?
Thanks!

I have found the following adb command works on devices that I develop on:
adb shell am start -n "com.android.systemui/.Somnambulator"
Credit to https://stackoverflow.com/a/21485967/11385462 for pointing in the right direction. YMMV.

Related

ADB debugging not restarting on reboot

I am running lineageOS on a rooted firestick. I am using ADB on the Firestick to control it via Homeassistant. The problem is that the adb debugging does not automatically work on reboot. Everytime i reboot i have to manually go to the menu turn off the ADB debugging and then turn in back on. After doing this i am able to reconnect adb via network (i.e, on homeassistant).
I want to ask is there any way i can use a script to automatically do this on restart of firestick. I have tried creating a script in init.d with the following contents but it doesn't seem to work.
adb tcpip 5555
I have added the following line to build.prop but this doesn't seem to work too
service.adb.tcp.port=5555
On restart the adb debugging is on in the developer tools but somehow it doesn't connect (either to Homeassistant or to my laptop), what seems to make it work is toggling it off and then back on.

AndroidTV: Turn display off/on via adb without loosing wifi?

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.

Is there a way to build and run an Android Studio app on a phone remotely?

I am developing an app for Android that controls a robot using the FTC SDK, and I need to be able to make small changes to motor values in the code and re-install it to test the new code. My problem is that I need to do this a lot of times, and the system of taking the phone out of the mount (which takes a while) and plugging it into my computer to upload, waiting for it to upload, turning off the power to the robot, plugging the phone back in to the robot, and turning the power back on has started slowing our progress down a lot. I was wondering if there was any way I could install the new code on the phone without taking it out of the mount.
Our phone is connected to a usb hub with a webcam and the hardware controller, so I was wondering if attaching a wireless usb transmitter to the hub and my computer would still let the phone show up on the android studio connections manager and let me install it.
So if anyone has done this before, or knows about any way to make this work, thank you for the help!
Yes. First make sure that the robot phone has developer mode and USB debug enabled.
(Do this by going to settings -> software info and click on build number ten times, then go settings -> developer options and enable USB Debug)
Then, go into the robot controller phone and under the three dots at the top right select program and manage. Connect your computer to the shown internet name and password.
Next if you are on Windows plug in the phone and run the following code in command prompt,
pushd "%userprofile%\AppData\Local\Android\sdk\platform-tools"
adb disconnect
adb tcpip 5555
adb connect 192.168.49.1
popd
PAUSE
If you are on Mac plug in the device and run the following code in terminal,
cd ~/Library/Android/sdk/platform-tools
./adb disconnect
./adb tcpip 5555
./adb connect 192.168.49.1:5555
Finally, disconnect the phone, go back to android studio and happy wireless coding.

Android code to boot device without press any power button?

Is it possible to boot the device when the battery is already inserted, and then main power is connected, without the help of any power switches?
Is there any ADB command to boot up the device after completely turned off?
Please keep in mind: I am not asking for reboot, I'll ask for boot after switched off.
Is there any Adb command to boot up the device after completely turned
off ??
No.
Perhaps it would help to understand that an app runs. For an app to run it needs a processor/cpu to process the commands. If a processor (cpu) has no power then it can;t process anything. Therefore the app needs power. If there is no power then the app can't run. If it can't run then it can't switch the phone on!!!!!!!
Really quite simple when you think about it.
The closest you will get is to set an alarm to wake up the system if it goes into hibernation/sleep mode
Hold the volume + & volume - and plug the usb cable into your device while its plugged into your PC, the phone should enter fastboot mode. Make sure you have adb and fastboot installed on your PC, open the platform tools folder that is in your PCs C: drive, hold the shift key on your keyboard and right click on an empty spot in the folder and open a command window. Run the following command: fastboot reboot

ADB: Libraries to simulate bluetooth device

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.

Categories

Resources