How To Execute Shell Commands In Android App

Apr 2, 2013

I need to execute following command in my app.

command: echo "1" > /sys/manager0/enable

I tried this with following code in my app.

Process p = Runtime.getRuntime().exec("su");
DataOutputStream stdin = new DataOutputStream(p.getOutputStream());
String cmd = "echo "1" /sys/manager0/enable";
stdin.writeBytes(cmd+"
");

There is no error and app executed perfectly but there is no change in the /sys/manager0/enable

How to execute shell commands in android app


General :: Execute Shell Commands From Tasker?

Jan 14, 2014

I am trying to create a tasker automated thing, which would show a scene which will have a button to execute a shell command (The command should be executed as root). how to do it?

Code:

reboot recovery

View 1 Replies View Related

Android :: Shortcut To Execute Commands On Computer

Aug 27, 2010

There are all of these app's out there that allow you to control your computer from your phone (using VNC and others). This is all well and good....but there are no shortcuts to do anything on these apps. Whatever you are trying to do on your computer takes way too many screens/clicks to be truly efficient by using your phone. You most certainly are able to do it with your phone.....but hell...it was way more complicated than it had to be.

DOES BELOW APP EXIST?
I would LOVE to just touch a shortcut on my home screen that would send a couple of keystrokes to my computer. Or telling my computer to open a particular program from a shortcut created on my android phones Home screen. This would be amazing. I could tell my computer to run whatever task from my phone QUICKLY...without having to jump hoops through screenshots/mouseclicks/keyboard on VNC app's......

Using this, you would no longer need all these separate video/music player control apps...you could just wire hotkeys/scripts to be run to control ANYTHING. I could send a keystroke to minimize/maximize a window....pause iTunes....Give a song 3 star rating....open a particular site...

I'm just trying to turn my phone into a much better remote for my computer.....all current apps seem to fail horribly.

View 2 Replies View Related

General :: Execute ADB Commands From C# Form?

Nov 2, 2012

Basically I have been working on a Boot animation changer for the Nexus 7 and the program so far is coded in a C# form for windows.

I have coded everything fine up till now. I need to run a ADB command to push a file from my Program files x86 to the nexus 7 and write over the original Boot file.

But is there a simple and easy solution for writing this code? Or do I need to make a console application which does this process when started?

( I can push files manually via ADB, but the point is to make the tool " one click " If you get my drift.)

View 9 Replies View Related

General :: Mapping Keycodes To Execute Commands

Apr 5, 2012

What I want to do is be able to map arbitrary keycodes to execute custom commands. I purchased a Bluetooth numeric keypad, and with CM7, I am able to sync it and generate key events. However, they're not mapped to anything, so it's pretty useless. My hope in buying this product was the ability to map the keys to input events and be able to control my phone (Maps, IME, etc) while my phone is docked in my car so I'm not doing the "distracted driving" thing. So, is there a way I could code an app/service that would capture key/scancodes and execute user-defined commands (such as screen events)? Further, could this service change its behavior when the IME is active, allowing me to map the keys to the on-screen keyboard? I use a T9 app, and if the program could map to screen events when the IME is active allowing me to type T9 on a physical keyboard, that would be amazing.

View 1 Replies View Related

Android :: Want To Know About Commands Available In Phone Shell?

Sep 5, 2010

Can't find information on how to print out documentation on android shell commands while in the shell. Something along the lines of.

View 4 Replies View Related

Android :: Execute Adb Shell Command At Runtime From Application

Apr 12, 2010

In my application I want to create a directory xyz in sdcard at the runtime from the my Application. But it doesn't work.

Here is my code...............

View 1 Replies View Related

General :: Execute ADB Commands From Java Desktop Application

Jun 28, 2012

I would like to execute adb commands from my Java application. At the moment I use Runtime.getRuntime().exec(command), is there a better way? Maybe even a library?

View 5 Replies View Related

Android :: Run Shell Commands On Droid Programmatically?

Jul 28, 2010

Is there any way to run terminal commands on my application and then access the data on my UI? Specifically top.

View 4 Replies View Related

Android :: Way To Execute Shell Script File From Droid Application

Jul 28, 2010

I am trying to execute a shell script from application using

java.lang.Process API.

The script file is executing properly as i am able to get logs but the line

*$SETPROP net.if.default rmnet0* * * is not getting executed.

has anyone able to execute .sh file from application succesfully.

Code Snippet: *//* *str={"/system/bin/sh","/sdcard/test.sh"};* *Process p = Runtime.getRuntime().exec(str);* * * *//* * * test.sh: LOG=/system/bin/log SETPROP=/system/bin/setprop $LOG -t test"++Setting up default iface"

$SETPROP net.if.default rmnet0 $LOG -t test"++Setting done "

View 5 Replies View Related

General :: How To Execute Command Shell Programmatically

Apr 11, 2012

i have made a kinda theme installer (for stockrom)..

so.. first of all i extract needed file from assets to sdcard

n on button click i add this line of code..

the code is work n sometimes not...

when execute the code, my phone hang for several time

"here is the line of execution code :

Code:

Process ppush;
try {
ppush = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(ppush.getOutputStream());
os.writeBytes("mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
");
os.writeBytes("cp /mnt/sdcard/dys/SystemUI.apk /system/app
");

[code].....

View 4 Replies View Related

Android :: Complete List Of Shell Commands Supported By Droid?

Apr 3, 2010

Is there a complete list, or there is no guarantee the list won't change with every release?

View 4 Replies View Related

Android :: Adb Shell Commands To Change Settings Or Perform Tasks On A Phone

Feb 4, 2010

How do I use adb to perform some automated tasks on my android phone? I need to find commands that I can issue from the command line (ideally, using a .bat file) that will be capable of more than simply opening an application or sending an input keyevent (button press).

For instance, I want to toggle Airplane Mode on or off from the command line. Currently, the best I can do is launch the Wireless & network settings menu and then use input keyevents to click Airplane mode:

CODE:.................

There are quite a few drawbacks to this method, primarily that the screen has to be on and unlocked. Also, the tasks I want to do are much broader than this simple example. Other things I'd like to do if possible:

1.Play an mp3 and set it on repeat. Current solution:

CODE:..................

2.Play a video. (current solution: open MediaGallery, send keyevents, similar to above)

3.Change the volume (current solution: send volume-up button keyevents)

4.Change the display timeout (current solution: open sound & display settings, send keyevents)

As before, these all require the screen to be on and unlocked. The other major drawback to using keyevents is if the UI of the application is changed, the keyevents will no longer perform the correct function. If there is no easier way to do these sort of things, is there at least a way to turn the screen on (using adb) when it is off? Or to have keyevents still work when the screen is off?

I'm not very familiar with java. That said, I've seen code like the following (source: http://yenliangl.blogspot.com/2009/12/toggle-airplane-mode.html) to change a setting on the phone:

Settings.System.putInt(Settings.System.AIRPLANE_MODE_ON, 1 /* 1 or 0 */);

How do I translate something like the above into an adb shell command? Is this possible, or the wrong way to think about it?

View 2 Replies View Related

Samsung Moment :: Shell / Terminal USB Commands?

Jun 5, 2010

I have a samsung moment that I seem to have inadverntantly disabled diagnostic usb access - if I have USB plugged in and then enable dial up networking in settings , USB disconnects - as soon as I disable DUN usb comes back up - I modified the setting in NV for scm from 3a to 2a and caused this, but I can't find a way to access non volatile memory any other way than through usb diagnostic mode

View 1 Replies View Related

Android :: Monkey Commands - Adb Shell Monkey - Port 1080

Sep 7, 2010

Once I start up monkey from the shell like:

adb shell monkey --port 1080

Then, If I write normal java code to establish a connection to 127.0.0.1:1080 (on the device itself) and then issue monkey commands from there?

I have tried this and I am able to create a socket, but to get the response, I wait for an awfully long time and nothing happens. Why this behavior?

View 2 Replies View Related

Android : Chrome Os Can Execute Apk?

Aug 31, 2009

Of course i don't know google's plan. i just hope it. through emulation though.

how about android-sdk for chrome application? the idea is just recompiling to make execution file for google chrome os.

how about the sdk for windows? it's for windows platform.

View 2 Replies View Related

Android :: Service Connection Does Not Execute

Jan 12, 2010

I do a ((Context)thingy).bindService(...) from within the onCreate callback of an Activity. I've observed that the onServiceConnected() callback of my associated Service Connection does not execute immediately, but rather, is delayed until after the Activity resumes, or more precisely, after return from the onResume() callback of the Activity. I discovered this the hard way (through a null pointer exception) because I was unable to use the Service (I call a method in the Service to start a Thread) immediately upon return from the bindService () call.

I assume this is normal behavior, but I don't understand why, and I further assume that there is a good reason for it and that I would benefit from understanding it. I'm guessing that maybe the Service isn't eligible to run because there are fewer than 1 processes bound that are in an active state.(?) But once it starts, if I then start the Thread within, it continues to completion of its task, even if the Activity calls unbindService() and terminates first! I don't mind that behavior (it's what I want to happen), but I want to know whether I can generally rely on it. I'm seeking some wisdom from the forum. Please help me clear my fog on all these points.

View 3 Replies View Related

Android :: Php Script To Execute Queries

Sep 1, 2010

There is a user input then on submit pass the search keywords to the db server and return the results (the db server has to be external by the way). Could i pass the search query to server side (php) and get the php script to execute the queries and return the scripts output?

View 3 Replies View Related

Android :: Need To Execute Dalvik Op-Codes

Jun 1, 2009

I would like to execute opcodes directly against the running Dalvik VM instance from within my application on Android. I'm looking for something similar to the C asm function. I have a list of opcodes for dalvik, but I am unfamiliar with how to either execute them directly, or write them out to .class files and execute them against some sort of VM CLI command like dalvikvm from within a running application.

View 2 Replies View Related

Android :: SDK >= 1.6 Requires Glibc >= 2.4 While Execute

Nov 3, 2009

I've been doing Android application development for Android 1.5 on Debian etch (4.0), and things were going okay. I then tried upgrading the SDK to support more recent platforms. The problem is that the vast majority of the tools that are executables (I'm not counting shell scripts) seem to now depend on glibc >= 2.4. When trying to execute them, or passing them to ldd, I get an error like:

./aapt: /lib/tls/i686/cmov/libc.so.6: version `GLIBC_2.4' not found (required by ./aapt)

On Debian, the file /lib/tls/i686/cmov/libc.so.6 is provided by the libc6-i686 package, which on etch is version 2.3.6.ds1-13etch7, but on lenny I see that the version has increased to 2.7-18.

I can think of a few workarounds: - Copy the required libraries from a supported platform and point to them with LD_LIBRARY_PATH when using the affected executables. - Download the sources for the tools (e.g. http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;...) and build my own local versions for Debian etch. - Give up using Debian etch and switch to another platform.

All of these are potentially viable alternatives for me, so this isn't a show stopper, and indeed http://developer.android.com/sdk/requirements.html says that it's only tested for GNU/Linux on Ubuntu Hardy Heron, which uses version 2.7-10ubuntu5. Nevertheless, it's somewhat annoying, and I'm wondering if anyone has any thoughts, or if the Android team even knows of the issue. I'm guessing that sometime in the transition from 1.5 to 1.6, they switched from an earlier Ubuntu version (I have to go back to Dapper, which uses 2.3.6-0ubuntu20.5, to find a pre-2.4 version) to Hardy, and this was just a side effect. But I'd be surprised if there was anything specific in the source that really required libc 2.4, and it's possible that if they were just building with an appropriate compiler flag that backwards compatibility could be maintained.

This affects all platform-specific tools for platforms >= android-1.6 (so aapt, aidl, and dexdump), and it affects all platform-agnostic tools (except for hprof-conf and mksdcard; so adb, dmtracedump, emulator, sqlite3, and zipalign) installed with the new modular sdk download (android-sdk_r3-linux.tgz) available starting in the android 1.6 timeframe (the corresponding tools from the android 1.5 timeframe in the monolithic SDK download of android-sdk-linux_x86-1.5_r3.zip work fine).

View 2 Replies View Related

Android :: How To Execute A Remote Service

Jul 28, 2010

I have a service MyService.java in Application "ServiceDemo". The manifest of this application looks like this

CODE:.............

I have another application "CallerService" manifest looks like this

CODE:................

I have an activity from where I m trying to start the service on the click of the button

CODE:................

This fails to work. Says "unable to start service intent"

View 1 Replies View Related

Android :: Can Execute String As Code

Aug 24, 2010

So basically I would like my app to read info from a database, this info would be a string that is valid java code. Once read, I would like my app to execute this string as if it were code. Is there any functionality packaged with the android sdk that supports this?

Essentially I want the phone to populate some data with information queried from a database. One of these pieces of information would be a statement like: "return data.ZombieKillTotal >= 100000;"

Which would be used inside a statement like:

CODE:......

I just don't know what to use for 'ExecStringAsCode':

View 3 Replies View Related

Android :: Failed To Execute Launcher

Feb 9, 2009

I need to customize the launcher application. I built it from the android source, and installed it to the emulator successfully(By renaming its package name to solve signing conflicts). When I tried to run my build, an exception occurred, and I can't find where it actually from because it seems to be from an internal thread.After an whole day trying, I found that the exception is thrown by the line in Launcher.java possibly: setContentView(R.layout.launcher)Does anyone have any suggestion?

View 9 Replies View Related

C Code Has To Execute In Android Application

Feb 7, 2012

i want to develop a android application named letC ,the main moto of the app is the user has to write c code and has to execute with in the application.

View 8 Replies View Related

Android :: Execute Code Before Exiting Application?

Nov 18, 2009

I would like to know how to execute code before exiting application. My application is composed of several activities. When the user starts the application (from the launcher menu or from a notification in the status bar), he goes in an InitActivity where I process some initializations. From user experience, application always restarts. One of these initializations is to init a network manager and start a thread that periodically sends a network request to notify a server that application is active.

I need to process some end operations, like stopping this thread when user quits application, for example by pressing the HOME key or BACK key when he's in the root activity. However, when the user press the HOME key, application is still running in background.

Q1 : is it possible to execute code when exiting application (I see the onTerminate() method of the class Application but it seems not to be always called)?

Q2 : Is it possible to force application exit (activity method finish () only destroy the current activity, not the application)?

Q3 : Is it possible to handle HOME key press (onKeyDown() is not called when this button is pushed)?

View 3 Replies View Related

Android :: Execute Other Activities When Click On Buttons

Apr 4, 2010

I have a problem with my application. During the execution of it, I have some buttons which execute other activities when I click on them. The way I am realising it is:

private OnClickListener scaleImage = new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); intent.setClass(main.this, Scale.class); startActivity(intent);

update(); }

};

View 2 Replies View Related

Android :: Program That Execute Root Explorer

Sep 16, 2009

I'm working on a G1 rooted. I have to implement program that execute "Root Explorer". I have write this code:

Process p;
try { p = Runtime.getRuntime().exec("su");
// OK DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo "HELLO!!!!!!!!" >/system/test.txt");
os.writeBytes("exit"); os.flush();
// ERROR File dir = new File("/data"); String [] list = dir.list();
Log.v("TEST]", String.valueOf(list.length));
try { p.waitFor(); int exit = p.exitValue();
if (exit != 255) { Log.v("TEST]", "ok");
} else { Log.v("TEST]", "Error");
} } catch (Exception e) { Log.v("TEST]",e.getMessage());
} } catch (Exception e) { Log.v("TEST]",e.getMessage());
}
I use Superuser.apk for execute "su" command. My program write file test.txt in /system but statement Log.v("TEST]", String.valueOf(list.length)); return value 0.

View 5 Replies View Related

Android :: Get IOException In HTTPClient.execute - Httppost

Oct 26, 2010

I am trying to upload a image file to server and get back a JSON Object. But an IOException was thrown out. Following is my codes, can anybody have a look at them?

CODE:.....................

View 4 Replies View Related

Android :: Way To Create Db / Table / Execute Queries?

Dec 14, 2009

I am using sqlite db in my app. i am able to create db and table and execute queries. But I wanted to know where is the sqlitedb created, so that I can check them from commandine. where doed that android store ? I searched, could not find anything on that name in my pc, does android encrypt the name of the db file ?

View 11 Replies View Related

Android :: Cannot Execute OnItemClick For GridView In PopupWindow

Jan 21, 2010

I have a gridView that I display in a popupwindow (the gridview is in a transparent layout, which inherits from linearlayout and just has a partially transparent background). I can never get this GridView's OnItemClick to execute. When I touch an image in my gridview it appears to be clicked (image bachgrond changes), but OnItemClick is not being called.

Below is the code for my Adapter and my popupview containing the gridView.

CODE:................

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved