Android :: Execute Adb Shell Command At Runtime From Application
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 Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Android :: Way To Execute Shell Script File From Droid Application
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 Replies!
View Related
Android :: Possible To Run ADB Shell Command From Inside An App
I am trying to run an ADB shell command from inside an android app using the JAVA's Runtime.getRunTime.exec API. I am getting an error "ERROR/ProcessManager(1041): Error running adb: Permission denied". Wanted to check if there is any permission that I need to request to get it working or that running the adb shell command would not be allowed from with in the Android app. I am able to execute other linux commands like 'ls' from the android app though.
View Replies!
View Related
Android :: Run A Shell Command From Within Code
I am trying to execute a command from within my code, the command is "echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness" and I can run it without problems from adb shell I am using Runtime class to execute it : Runtime.getRuntime().exec("echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness"); However I get a permissions error since I am not supposed to access the sys directory. I have also tried to place the command in a String[] just in case spaces caused a problem but it didn't make much differense.
View Replies!
View Related
Android :: Possible To Run ADB Shell Hello.c Command From Inside An App
I have copied a file named hello(compiled form hello.c) in android data folder and using command like "adb shell datahello" in android machine terminal. and it give fine output. Actual Question is that is there is any way that in button click listener, i initiate the same command like "adb shell datahello" (or any other appropriate way to execute adb shell commands) and gets its output in TextView.
View Replies!
View Related
Android :: Not Able To Connect Device Using Adb -d Shell Command From Vista
I am trying to use "adb -d shell" command to start a shell on device (android dev 1 phone ) from my vista command line. But whenever I try giving such command it does not open any shell or interaction on the phone device. But instead it goes to the next line in the cmd as '$'. any help would really appreciable. I have installed adb_usb_windows. Previously I used work well with the emulator. Using adb command never troubled me. But now with new device, I am not able to open a shell using adb -d shell command on the phone.
View Replies!
View Related
Android :: Getting Result Of Executed Shell Command Fails / Hangs
I try to execute shell commands, this does work as it should. Even the result comes back (as is see on LogCat). The problem ist the last line of the result. Every time a readLine() on the last line occurs (which shouldn't occur, temp should be null), the app hangs forever and doesn't come back from the readLine call. Maybe you find the error. I tried readUTF and standart read(), all the same problem. And yes, the app got su-rights. try { Process process = Runtime.getRuntime().exec("su"); DataOutputStream os = new DataOutputStream(process.getOutputStream()); DataInputStream osRes = new DataInputStream(process.getInputStream()); for (String single : commands) { os.writeBytes(single + " "); os.flush(); String temp = new String(); while( (temp = osRes.readLine()) != null) { Log.v("NITRO", temp); result2 += temp + " "; } } os.writeBytes("exit"); os.flush(); process.waitFor(); } catch (IOException e) { Toast.makeText(Main.this, "Error", Toast.LENGTH_LONG); } catch (InterruptedException e){ Toast.makeText(Main.this, "Error", Toast.LENGTH_LONG); } That is the StackTrace where it hangs when I stop debugger when hanging: OSFileSystem.readImpl(int, byte[], int, int) line: not available [native method] OSFileSystem.read(int, byte[], int, int) line: 118 ProcessManager$ProcessInputStream(FileInputStream).read(byte[], int, int) line: 312 ProcessManager$ProcessInputStream(FileInputStream).read() line: 250 DataInputStream.readLine() line: 309 Main$2$1.run() line: 84 ViewRoot(Handler).handleCallback(Message) line: 587 ViewRoot(Handler).dispatchMessage(Message) line: 92 Looper.loop() line: 123 ActivityThread.main(String[]) line: 4627 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 868 ZygoteInit.main(String[]) line: 626 NativeStart.main(String[]) line: not available [native method]
View Replies!
View Related
Android :: Deliver Test Params Using Adb Shell Am Start Command
I wish to know how in java I should receive these parameters. I do know how to deliver parameters via adb shell am start command but I still have a problem to get them in java (android) code. My class extends InstrumentationTestCase and not Activity class! So I cannot perform: this.getIntent(). I anderstand that I need to create intent doing: Intent intent = new Intent(Intent.someAction); Can you help me to find out what action should I use here. I also read that there are secondary attributes: category, type, component, extras. I know that I also need to update the manifest file accordingly. Sorry for so many q/a.
View Replies!
View Related
Android :: Execute Code Before Exiting Application?
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 Replies!
View Related
Android :: Application Checksum At Runtime
As an additional anti-pirating strategy, I'd like to compute a checksum on my application at runtime. Since my app communicates with a back-end server, I can send the checksum with each message and the server can deny service to altered apps. Not a complete solution to piracy by any means, but a fairly easy way to raise the bar. Anyone know how an app can get access to it's load image at runtime?
View Replies!
View Related
Android :: Executing A Shell Script From Droid Application?
I am configuring wifi on my android based board using shell script. Now I want to execute the same script from android application. For that, I had used following code, but it didn't give any success till now, I had executed same script from "adb shell" prompt and it works nicely. Process exeCommands = Runtime.getRuntime().exec("/data/busybox/ board_script.sh"); is there anything else required than this?
View Replies!
View Related
Android :: Runtime (321) Java.lang.Verify On Testing Application
i get following error, if i test my app on a real android phone. On the emulator, my app works fine. W/dalvikvm( 321): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) E/AndroidRuntime( 321): Uncaught handler: thread main exiting due to uncaught exception E/AndroidRuntime( 321): java.lang.VerifyError: de.stefandahmen.android.TourList E/AndroidRuntime( 321): at java.lang.Class.newInstanceImpl (Native Method) E/AndroidRuntime( 321): at java.lang.Class.newInstance (Class.java:1472) E/AndroidRuntime( 321): at android.app.Instrumentation.newActivity(Instrumentation.java:1097) E/AndroidRuntime( 321):.....
View Replies!
View Related
Android :: Bluetooth Headset Application / Say Command
I have a Motorola bluetooth headset and with my old Storm I could push the button on the headset and it would say "Say a command" from here I could say "Call John Doe mobile" and it would call him up. Haven't figured out how to make this work on the Droid in the same manner natively. Is it possible or is there an application. Purpose of bluetooth is to be hands free. Its not very hands free if I have to pull my phone out my pocket to dial the number first to be able to use the headset.
View Replies!
View Related
Android :: Application That Sends Command Line To PC
Does anyone know if there is an application that will send command lines to a PC? I would like to use this to either both launch programs and send other commands (such as changing the audio output on my PC). I am able to do this by creating shortcuts to the commands, then using a remote program (like premotedroid) to control the mouse and click the shortcuts, but it would be really cool if the phone could just send the command directly to the PC.
View Replies!
View Related
Android :: Application Debugging With Command Line Jdb
I'm configuring emacs to debug android apps. My problem is since I'm attaching jdb to DDMS I cannot set proper classpath (jdb just won't start when I try to set -classpath and -attach together). So jdb is practically blind - no entry point for class, no interactive debugging. How can I specify classpath when attaching debugger to ddms?
View Replies!
View Related
Android :: Runtime Error Using Exported - Signed Apk But No Runtime Error Using Eclipse IDE
1) I am developing my app in Eclipse 3.4.1 with Android (ver 1.1_r1) plugin. My app compiles and executes without errors when using the Eclipse IDE. However, when I export my app (unsigned) using Eclipse (via {select project} >right-click>Android tools>export unsigned application package), sign it, and try to run it on the Emulator, it throws a runtime error when I try to update my sqlite database, at which time the specific error created is: SQLite error#14, unable to open database. It is able to read from the database without problems. (I have also verified that the database is: open, is not readonly, is not locked by another thread, is not in the middle of a transaction.) I have limited experience, but this seems more like a "system" problem given that the app works OK in Eclipse IDE but then fails as an exported/signed apk. Some googling of SQLite resources revealed a similar error on a non-Android platform which was fixed by: "Set your permissions correctly on /var/tmp, or whatever directory you are using to hold temporary files". Does Android have temporary files, and if so how does it handle permissions on temporary files? Is there a way to check or set these permissions to see if this fixes my problem here? 2) Not sure if it is related, but after I have run the exported/signed app which causes the runtime error, if I reboot the Emulator, and try to run the program using the Eclipse IDE , the program fails with the same exact error. PLUS I also noticed the following error message while the program is installing/running: 03-01 22:22:29.282: ERROR/PackageManager(53): Package com.northwestradiology has mismatched uid: 0 on disk, 10019 in settings; read messages: I can restore the Eclipse version of my program to be able to execute without runtime errors by utilizing the -wipe-data option for the emulator. But note that if I run my signed APK using an emulator created with the -wipe-data option, it still throws the runtime error listed above...
View Replies!
View Related
Samsung Captivate :: Wifi - Error 'mmc1 Got Command Interrupt 0x00060001 Even Though No Command Operation Was In Progress
I have a rooted samsung captivate with sideloading enabled. After experimenting with different wifi tethering apps from the unofficial market, I began experiencing difficulties with my wifi connection. Even after uninstalling every app that I thought was changing the wifi state, the problem still persists. I can turn on the wifi and it will act normally for about 30 seconds before turning off without user intervention. In dmesg, the error is as follows: 'mmc1: Got command interrupt 0x00060001 even though no command operation was in progress.' Is this caused by an app or is this a more complicated problem?
View Replies!
View Related
Android : Chrome Os Can Execute Apk?
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 Replies!
View Related
Android :: Service Connection Does Not Execute
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 Replies!
View Related
Android :: Php Script To Execute Queries
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 Replies!
View Related
Android :: Need To Execute Dalvik Op-Codes
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 Replies!
View Related
Android :: SDK >= 1.6 Requires Glibc >= 2.4 While Execute
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 Replies!
View Related
Android :: How To Execute A Remote Service
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 Replies!
View Related
Android :: Can Execute String As Code
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 Replies!
View Related
Android :: Failed To Execute Launcher
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 Replies!
View Related
Android :: Execute Other Activities When Click On Buttons
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 Replies!
View Related
Android :: Program That Execute Root Explorer
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 Replies!
View Related
Android :: Way To Create Db / Table / Execute Queries?
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 Replies!
View Related
Android :: Shortcut To Execute Commands On Computer
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 Replies!
View Related
Android :: Cannot Execute OnItemClick For GridView In PopupWindow
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 Replies!
View Related
|