How to launch an application from Terminal? - myTouch 3G, Magic Android Development

Hi guys,
I want to know how to launch an application installed in my Android from command line?
In windows, for example, exists "start" command:
Code:
C:\>start notepad.exe
It Starts notepad application.
Exists something like that in Android?
Thanks in advance.

This thread continue in:
http://forum.xda-developers.com/showthread.php?t=580291
Thanks.

Related

Running Shell Command?

Hey guys. I was wondering...
Is there a way to run a shell command via an application? Meaning, I have a application and once the user clicks a button, i want that that to execute a shell command. For example, if i wanted it to restart the phone, i would want 'reboot' or 'restart' to be executed.
Thanks!!
yes and no.
It can be done, the terminal app does it. but that uses a non-public api and thus you couldn't write such an app using the sdk but if you downloaded the android source code and got a full build enviroment up and running the command line tools that uses could build apks with private api calls.
SilentMobius said:
yes and no.
It can be done, the terminal app does it. but that uses a non-public api and thus you couldn't write such an app using the sdk but if you downloaded the android source code and got a full build enviroment up and running the command line tools that uses could build apks with private api calls.
Click to expand...
Click to collapse
So it can be done, but I will not be able to use the SDK? I have use the Android Source Code?
herbjr said:
So it can be done, but I will not be able to use the SDK? I have use the Android Source Code?
Click to expand...
Click to collapse
Don't see why you would need the Android source. Examine lines 198-205 in the superuser source code:
http://code.google.com/p/superuser/...koushikdutta/superuser/SuperuserActivity.java
Hmm, interesting. The Android Terminal uses "android.os.Exec" (to pipe to and from "sh") which does not exist in the SDK's class library (but does exist in the framework jar on the device) I wonder why they hide that but allow Runtime.Exec.... well that bodes well for the Terminal rewrite I wanted to do, thanks.

[Q] how to define PATH

Hi
i try to compile a simple jni sample and get:
Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles"
How should i do what?
Many thanks
Michael
Assuming you are doing all this stuff from a command prompt, enter:
C:\>SET SDL_JAVA_PACKAGE_PATH = "com_examples_SanAngeles"
C:\>
Note that this environment variable will only last for the life of the command window, if you start up a second one, you will have to type it in there, as well.
To set the value permanently, use Control Panel -> System.
Click the Advanced Tab, then the Environment Variables button, and add the value.
Hi
thanks for the reply but I get:
[email protected]:~/Android-cpp/projects/test$ SET SDL_JAVA_PACKAGE_PATH = "com_examples_SanAngeles"
SET: command not found
I saw some other alike below but still don't know how/where:
# Set environment to CrystaX NDK with RTTI and exceptions instead of original NDK
# export PATH=$PATH:~/src/endless_space/android-ndk-r4-crystax/ndk-build
Regards Michael
Post #2 above will not work, as it is for a Windows command prompt. You failed to mention the fact that you are running under Linux. Also from a command prompt, Linux is case sensitive, Windows isn't.
Under Windows 'SET' and 'set', even 'sEt' are the same thing, under linux they are all different.
For a crash course on Linux environment variables try the links below:-
http://www.codecoffee.com/tipsforlinux/articles/030.html
or
http://lowfatlinux.com/linux-environment-variables.html
Yes i might figure the syntax but how should i know the path?
I've installed android sdk and ndk both the latest.
Again thanks
Michael
I would suggest posting this in the Android Development section, but unfortunately, you need 10 posts to be able to do it.
I'm really a Windows/WinMo developer, with only a passing knowledge of Linux/Android.
You could PM the moderator of this forum, madnish30 and request to have it moved over, but you still will not able to reply until you have clocked up 10 posts.
ahso said:
Yes i might figure the syntax but how should i know the path?
Click to expand...
Click to collapse
It's not a filesystem path - it is a Java namespace path. As it is package-specific there's no way to say on given information what the corresponding path should be.

[Q] ADB doesn't work on Mac

When I CD to the platform-tools folder and type
Code:
adb devices
it says "adb: command not found" If anyone could help me that would be wonderful. I am on the Inspire/DesireHD running AOSP Gingerbread. Thanks!
You have two choices. You can either run the command prefixed with ./ (dot slash), which allows for executing an executable in the current directory:
Code:
./adb devices
Or, the other choice (which will be better if you intend to use adb a lot) is to add the platform-tools folder to your path by editing or creating the file .bashrc in your home folder (~/.bashrc).
Let's suppose your platform tools folder is: ~/.android-sdk/platform-tools
Then, you would want to add something along the lines of the following to your bashrc:
Code:
export PATH="$PATH:$HOME/.android-sdk/platform-tools"
Save the file, the run this or log out/in:
Code:
source ~/.bashrc
Et voila, you should now be able to run adb from any folder without issue.
Explanation: adding the new path (folder) to your PATH environment variable tells BASH to include that folder in its search for an executable. The reason $PATH is added at the beginning of the new string is so that your default path does not get overwritten. $HOME will simply expand to /home/your_user_name when BASH interprets it.
GENIUS! IT WORKED! Thank you! Now, one more question- how do I get superuser privileges using ADB? (device is rooted, of course)
No problem.
On my G1 you were root as soon as you adb'd in. Just tested on my Defy and '$' - shocking. So once you have run adb shell, just run 'su' (without quotes of course) and accept the permission on your phone screen as usual for root programs and you should be good to go.
Sorry to keep asking questions, but when I typed
Code:
su
into adb, it asked for a password. No popup on device screen. I do have superuser installed on the device.
That is odd. I'm not sure why that would be. I'll see if I can think of something though. Hopefully someone else can make a suggestion.
Thanks! You have been very helpful.
Don't think I can hit the thanks button from the app, sorry
Sent from my Inspire 4G using XDA App

ADB batch quick launch

So this isn't anything amazing, but it's a handy little shortcut I made for myself that might help someone else, too.
If you regularly find yourself needing to fire off a command from ADB, but don't want to have to go to the trouble of adding ADB to your path or remembering where it's saved, you can create a batch file so you only have to press three letters to get adb ready to go.
Using a text editor (I like Notepad++), create a new text file with this inside of it:
@echo off
cd "path to where your Android SDK installation is located\android-sdk-windows\platform-tools"
(I find it easiest to just navigate to where you have ADB installed and copy and paste the folder location.) For example, my adb.bat file says:
@ echo off
cd "C:\Users\(me)\Other\mod\tools\android-sdk-windows\platform-tools"
Once you have those two lines above in place, do a "Save As" command, and save the file as "adb.bat" (with quotes).
Once you have that batch file ready to go, assuming you're on Windows 7 (may work on other versions of Windows, I just haven't tried) put it in whatever location comes up by default whenever you open a command prompt (It's C:\Users\[my account] for me).
The next time you open a command prompt (Win-R, type cmd), just type adb into the prompt and hit enter, and you're sitting at the directory where ADB is installed, ready to fire off other commands.
thanks, awesome!! works perfectly minus my lack of adb skill...
We will be waiting for new ROM from you. No less.

[Q] Adb/sqlite3 problem

I'm trying to edit a specific database in my phone, /data/data/com.android.providers.settings/databases/settings.db
to change the sms check.
Now, when I open a cmd on my computer and try the command: adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db,
it opens sqlite3 in the desired database and wow, so close.
Then, my command prompt won't let me type anything in.
I could smash my face into a keyboard and cmd wouldn't do anything.
I've also tried pulling the /databases folder to my desktop and using sqlite3 to edit it from there, but the same outcome happened. as soon as it loads the settings.db, cmd goes bad.
Any idea what's happening here?
EDIT: Whenever I open sqlite3 at all, it freezes my prompt. wow.
Did you find how to to this? I'm stack in the same situation.
Thank you.

Categories

Resources