Hello,
I would like to start an app installed on a non rooted fire tv (generic solution, and as an example for xbmc) by adb. I found some examples, which all don't work... (I am able to start the adb shell and launch other commands...)
eg:
Code:
am start -a android.intent.action.MAIN -n org.xbmc.xbmc/android.app.NativeActivity
returns
Code:
Error type 3
Error: Activity class {org.xbmc.xbmc/android.app.NativeActivity} does not exist
.
Is this not possible on non rooted fire tv's?
Or do I just use a wrong syntax?
I am working on some remote conrtrol options, so launchers are not a solution for me.
Thanks for support.
adb shell am start -n org.xbmc.xbmc/.Splash
Kramar111 said:
adb shell am start -n org.xbmc.xbmc/.Splash
Click to expand...
Click to collapse
Works, thanks a lot!
Is there any way to get this for other apps out of the system?
eg: if I want to start netflix the same way, can I get the parameters from anywhre in the system or is "google my friend""?
with aapt (part of Android SDK):
run
Code:
aapt dump badging name.apk
and search line "launchable-activity"
or in GNU/Linux run
Code:
./aapt dump badging name.apk | grep "launchable-activity"
Kramar111 said:
with aapt (part of Android SDK):
run
Code:
aapt dump badging name.apk
and search line "launchable-activity"
or in GNU/Linux run
Code:
./aapt dump badging name.apk | grep "launchable-activity"
Click to expand...
Click to collapse
adb shell am start -n ir.hamgam.mobile/.Splash
for doesn't work plz help me
Related
Hello all,
I recently rooted my phone and installed the RemICS-UX Port | ICS 4.0.4 by Team D.I.R.T. It's been great so far but I'm running into some issues running adb shell commands. For example:
Code:
$ adb shell
sh-3.2$ pm list packages
Segmentation fault
However, if I use su then I can run the commands:
Code:
sh-3.2$ su
sh-3.2# pm list packages
package:android
package:android.googleSearch.googleSearchWidget
package:com.anddoes.launcher
package:com.android.backupconfirm
...etc...
Has anyone run into a similar issue before? The IDE I use for Android development uses "pm install" and "am start" to deploy apps to the device. I really need to be able to run those commands without requesting superuser access. Any and all help is greatly appreciated.
Hi,
I am running the recently released stock ROM version 4.1.2 downloaded via Kies.
I am trying to debug a Bluetooth problem. However, I cannot see Bluetooth messages when I run the following script using command 'sh btlog' on my android from a terminal:
#!/system/bin/sh
su
print START
# logcat -c
# logcat -v time |grep ".*[bB]luetooth.*"
logcat -v time | grep Bluetooth
print END
It will only output:
START
And, if I run 'logcat | grep Bluetooth' from a terminal session on the android I do not get any output.
But if I run 'sh btlog' from an adb shell I do see the Bluetooth messages, and if I run 'logcat | grep Bluetooth' from an adb shell I also get the expected output.
Can anyone help?
Thanks
Brushborder said:
Hi,
First,I hope this is posted in the right place. I have not been here in ages!
I am running the stock ROM and ICS 4.1.2
I am trying to figure out a problem with my S2 and how it randomly disconnects from some Bluetooth devices. However, I cannot see Bluetooth messages when I run my script using command 'sh btlog' on my android from a terminal:
#!/system/bin/sh
print START
# logcat -c
# logcat -v time |grep ".*[bB]luetooth.*"
logcat -v time | grep Bluetooth
print END
It will only output:
START
And, if I run 'logcat | grep Bluetooth' from a terminal session on the android I do not get any output.
But if I run 'sh btlog' from an adb shell I do see the Bluetooth messages, and if I run 'logcat | grep Bluetooth' from an adb shell I also get the expected output.
Can anyone help?
Thanks
Click to expand...
Click to collapse
get on stock 4.1.2, it was released for our device a while back it might solve your issue
imo ics is dead now
JesusWazBlack said:
get on stock 4.1.2, it was released for our device a while back it might solve your issue
imo ics is dead now
Click to expand...
Click to collapse
Maybe I misspoke. I'm on the stock 4.1.2. Downloaded via kies last week or so, but it is still causing problem. Better, but still disconnects and does not allow reset which is why I am trying to look at log. Thx
Brushborder said:
Hi,
I am running the recently released stock ROM version 4.1.2 downloaded via Kies.
I am trying to debug a Bluetooth problem. However, I cannot see Bluetooth messages when I run the following script using command 'sh btlog' on my android from a terminal:
#!/system/bin/sh
su
print START
# logcat -c
# logcat -v time |grep ".*[bB]luetooth.*"
logcat -v time | grep Bluetooth
print END
It will only output:
START
And, if I run 'logcat | grep Bluetooth' from a terminal session on the android I do not get any output.
But if I run 'sh btlog' from an adb shell I do see the Bluetooth messages, and if I run 'logcat | grep Bluetooth' from an adb shell I also get the expected output.
Can anyone help?
Thanks
Click to expand...
Click to collapse
Well, I fixed the code problem. Basically, I am executing this script as a task when bluetooth starts. I have to make sure the task manager is executing this as super user. Not in the script itself, but calling from super. Now my logger works, now to debug the exceptions.
The Android Shell
A "shell" is a program that listens to keyboard input from a user and performs actions as directed by the user. Android devices come with a simple shell program. This shell program is mostly undocumented. Since many people are curious about it I thought I'd write up some documentation for it.
Currently this documentation is incomplete, sorry!
Common problems
The built-in shell has very limited error handling. When you type a command name incorrectly it will say "permission denied", even though the real problem is that it couldn't find the command:
$ dir
dir: permission denied <---- this is a misleading error message, should say 'dir: not found'
$ ls
... listing of current directory
The PATH variable
The Android shell will run any program it finds in its PATH. The PATH is a colon (':') seperated list of directories. You can find out what your shell's PATH is set to by using the built-in echo command:
$ echo $PATH
/data/local/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
Depending upon your shell, you may see a different result.
Built in Commands
Every shell has a few built-in commands. Some common built-in commands are:
echo -- prints text to stdout.
set -- sets shell variables
export -- makes shell variables available to command-line programs
cd -- change the current directory.
pwd -- print name of the current directory.
Commands
To find out what commands you have available to you, use the "ls" command on each of the directories in the PATH variable.
Finding documentation for the Android commands.
Many of the Android commands are based on standard Linux (or bsd) commands. If you're curious about a command, you can sometimes learn how it works by using the "man" command on a desktop Linux or OSX (Apple Macintosh) computer. The Linux or OSX version of the command may be different in details, but much of the documentation will still apply to the Android version of the command.
Another source of documentation for people without a Linux or OSX machine handy is to use a web browser and use a web search engine to search for the text: "man Linux command-name".
List of commands
The following is a list of the commands that are present on a Nexus S phone running an Android 2.3.3 "user-debug" build. Many of these commands are not present on a "user" phone. (They are missing from a "user" phone because they are specific to developing or debugging the Android operating system.)
$ ls /data/local/bin
/data/local/bin: No such file or directory
Notice that by default there is no /data/local/bin directory. You can create this directory using the "mkdir" command if you like.
$ ls /sbin
opendir failed, Permission denied
The /sbin directory exists, but you don't have permission to access it. You need root access. If you have a developer phone, or otherwise have root access to your phone you can see what's in this directory.
$ su
# ls /sbin
ueventd
adbd
# exit
$
Notice that the shell prompt changes from a '$' to a '#' to indicate that you have root access.
Notice also that neither of the /sbin commands are useful to the shell -- the adb and ueventd files are 'daemon' programs used to implement the Android Debugger "adb" program that is used by developers.
$ ls /vendor/bin
gpsd
pvrsrvinit
Vendor/bin is where device vendors can put device-specific executables. These files are from a Nexus S.
$ ls /system/sbin
/system/sbin: No such file or directory
This directory does not exist on a Nexus S.
$ ls /system/bin
am
am is the Android Activity Manager. It's used to start and stop Android activities (e.g. applications) from the command line. Type am by itself to get a list of options.
amix
aplay
Command line audio file player.
app_process
applypatch
Used to apply patches to android files.
arec
Command line audio recorder.
audioloop
bluetoothd
BlueTooth daemon
bmgr
Backup manager - type command by itself to get documentation.
bootanimation
Draws the boot animation. You may have to reset your phone to get out of this.
brcm_patchram_plus
bugreport
cat
Copy the contents of a file to standard output.
chmod
Change the mode of a file (e.g. whether it can be read or written.)
chown
Change the owner of a file.
cmp
Compare two files byte-by-byte
dalvikvm
The dalvik virtual machine. (Used to run Android applications.)
date
Prints the current date and time
dbus-daemon
dd
Convert and copy a file. By default copies standard in to standard out.
debuggerd
dexopt
df
Shows how much space is free on different file systems on your device.
dhcpcd
dmesg
dnsmasq
dumpstate
dumpsys
dvz
fsck_msdos
gdbserver
getevent
getprop
gzip
hciattach
hd
id
ifconfig
Shows the current configuration of network interfaces (IP, MAC address etc)
iftop
Shows the current processes using the network interfaces (top, but for networks)
ime
input
insmod
installd
ioctl
ionice
iptables
Manage the firewall
keystore
keystore_cli
kill
Send signals to processes.
linker
ln
Used to set up a file system link.
log
logcat
Prints the Android runtime log.
logwrapper
ls
Lists files.
lsmod
lsof
make_ext4fs
mediaserver
mkdir
Make a directory.
monkey
A program that sends random events, used to test applications. (Like having a monkey playing with the device.)
mount
mtpd
mv
Move a file from one directory to another. (Only on the same file system. Use "cat a > b" to copy a file between file systems.
nandread
ndc
netcfg
netd
netstat
newfs_msdos
notify
omx_tests
pand
ping
pm
pppd
printenv
ps
List active processes.
qemu-props
qemud
racoon
radiooptions
reboot
Reboot the device.
record
renice
rild
rm
Remove a file.
rmdir
Remove a directory.
rmmod
route
rtp_test
run-as
schedtest
schedtop
sdcard
sdptool
sendevent
service
servicemanager
setconsole
setprop
setup_fs
sh
showlease
sleep
smd
stagefright
start
Starts the Android runtime.
stop
Stops the Android runtime.
surfaceflinger
svc
sync
system_server
tc
testid3
toolbox
top
Shows which processes are currently using the most CPU time.
umount
uptime
Prints how long your device has been running since it was last booted.
vdc
vmstat
vold
watchprops
wipe
wpa_cli
wpa_supplicant
$ ls /system/xbin
add-property-tag
btool
check-lost+found
dexdump
dhdutil
hcidump
latencytop
librank
opcontrol
oprofiled
procmem
procrank
rawbu
scp
Secure copy program. (Used to copy files over the network.)
showmap
showslab
sqlite3
Used to administer SQLite databases.
strace
System trace command - use to see what system calls a program makes.
su
Start a shell with root privileges.
Versions of the Android Shell
Android 1.0 used a shell that had no tab completion or history editing.
Android 2.3 added history editing. You can for example use the up/down arrows to edit previous commands.
About
I know that there a lot of guides out there which help you in creating logcat reports.
As there are so many and not one of them was good enough for my requirements I decided to create an own simple guide where I can refer to..
Windows & Linux: Log to a file (recommended way!)
Follow Post #2
Alternative: Windows & Linux: Log to terminal window
Follow Post #3
Trouble, connection or other issues
If you encounter any issues consider to try FWUL which is made for a stable and out-of-the-box working android connection
.
RECOMMENDED: Windows & Linux: Log to a file
1) Ensure you have adb set up on your PC, and have adb debugging and "developer options -> Root access -> ADB only" enabled or rooted the device otherwise
2) open the adb shell:
option A) when: developer options -> Root access -> ADB only is enabled:
adb root
adb shell
option B) when: magisk/supersu installed:
adb shell
su
Click to expand...
Click to collapse
3) The next step depends on what is needed (if you are not sure which one then it is likely option B) :
option A) ONESHOT (e.g. to debug general issues. for boot issues go to option C instead) :
logcat -b all -d -D > /sdcard/Download/logcat.txt
Click to expand...
Click to collapse
option B) SPECIFIC ISSUE (e.g. app crashes etc. for selinux issues go top option D instead):
logcat -c -b all
(this will print nothing - it will just clear the log buffer)
now reproduce the issue
when the issue occurred:
logcat -b all -d -D > /sdcard/Download/logcat.txt
Click to expand...
Click to collapse
option C) FULL BOOT log (requires Linux / FWUL):
exit from "adb shell" screen.
Power off your phone and type in the the terminal:
when 2A) matches your setup:
adb wait-for-device && adb root && sleep 1s && while true;do adb shell dmesg -c; done >> dmesg.log
when 2B) matches your setup:
adb wait-for-device && while true;do adb shell su -c dmesg -c; done >> dmesg.log
now power on your phone and wait until Android has fully booted, login and when you see the Android Home screen:
CTRL + C in the terminal window
The log will be generated locally in Linux (name: dmesg.log) and so you can skip step 4 and go on with 5
Click to expand...
Click to collapse
option D) SELINUX (e.g. needed to debug selinux issues when in enforcing mode or if enforcing is what you want to achieve one day) :
logcat -b main -e avc: > /sdcard/Download/logcat.txt
if you have a specific issue reproduce it now or turn it on/off whatever not works atm.
CTRL + C in the terminal window once you are finished
Click to expand...
Click to collapse
4) exit from the adb shell & grab the log from your PC:
Code:
exit
adb pull /sdcard/Download/logcat.txt
5) Share the content of this logcat.txt using https://privatebin.at/ (ensure you select at least 1 month or more as expire date!)
If for any reason the above link does not work for you then use on one of the billions other paste services.
Here some examples:
https://bpa.st/
https://0bin.net
https://hastebin.com
https://controlc.com
https://justpaste.me
https://privatebin.net
https://pastebin.com
https://paste.ubuntu.com (login required)
more examples: https://wiki.ubuntu.com/Pastebin
6) Always share your model name (e.g. H811, H815, ...) and how you unlocked (official or e.g. by UsU)
ALTERNATIVE: Windows & Linux: Log to terminal window
Windows preparation
If the recommended way fails for any reason you can also print the logcat output in the terminal window.
For this open the terminal and type:
Code:
mode con lines=32766
and ENTER.
This sets the buffer in your terminal to the max possible which is needed due to the log verbosity.
Begin (Windows & Linux)
1) Ensure you have adb set up on your PC, and have adb debugging and "developer options -> Root access -> ADB only" enabled or rooted the device otherwise
2) open the adb shell:
option A) when: developer options -> Root access -> ADB only is enabled:
adb root
adb shell
option B) when: magisk/supersu installed:
adb shell
su
Click to expand...
Click to collapse
3) The next step depends on what is needed (if you are not sure which one then it is likely option B) :
option A) ONESHOT (e.g. to debug general issues. for boot issues go to option C instead) :
logcat -b all -d -D
Click to expand...
Click to collapse
option B) SPECIFIC ISSUE (e.g. app crashes etc. for selinux issues go top option D instead):
logcat -c -b all
(this will print nothing - it will just clear the log buffer)
now reproduce the issue
when the issue occurred:
logcat -b all -d -D
Click to expand...
Click to collapse
option C) FULL BOOT log (requires Linux / FWUL):
exit from "adb shell" screen.
Power off your phone and type in the the terminal:
when 2A) matches your setup:
adb wait-for-device && adb root && sleep 1s && while true;do adb shell dmesg -c; done
when 2B) matches your setup:
adb wait-for-device && while true;do adb shell su -c dmesg -c; done
now power on your phone and wait until Android has fully booted, login and when you see the Android Home screen:
CTRL + C in the terminal window
Click to expand...
Click to collapse
option D) SELINUX (e.g. needed to debug selinux issues when in enforcing mode or if enforcing is what you want to achieve one day) :
logcat -b main -e avc:
if you have a specific issue reproduce it now or turn it on/off whatever not works atm.
CTRL + C in the terminal window once you are finished
Click to expand...
Click to collapse
4) copy the whole console output
5) Share the content of this logcat.txt using https://privatebin.at/ (ensure you select at least 1 month or more as expire date!)
If for any reason the above link does not work for you then use on one of the billions other paste services.
Here some examples:
https://bpa.st/
https://0bin.net
https://hastebin.com
https://controlc.com
https://justpaste.me
https://privatebin.net
https://pastebin.com
https://paste.ubuntu.com (login required)
more examples: https://wiki.ubuntu.com/Pastebin
6) Always share your model name (e.g. H811, H815, ...) and how you unlocked (official or e.g. by UsU)
reserved
So it's possible to start an app with adb commands like
Code:
adb shell am start -n ...
. I found a gist which shows, that it's also possible with some parameter, so you could not only start the app but also a specific movie. Now I want to do the same, but instead of a movie I want to start twitch with a specific channel. What is the syntax?
Edit: ok, solution is like this
Code:
adb shell am start -a android.intent.action.VIEW -d twitch://stream/STREAMERNAME tv.twitch.android.viewer