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
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
Sep 24, 2010
I don't know how to elegantly solve the following task:
I have several blocks of code (operation) to execute. Each block can return true of false to indicate that further execution is possible. Inside of each block I have to use asyncronous methods calls (Because Android is completeley asynchronous).
Example of processing operations (not working now as expected):
CODE:.......
The problem is that inside of the operation I need, for example, display AlertDialog and wait for the input. But after I call dialog.show() my method execute finishes and it returns incorrect result.
Example of the button listener, registerd with AlertDialog is below:
CODE:..........
How should I modify processing of operations to support asynchronous model of Android?
View 2 Replies
View Related
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
View 2 Replies
View Related
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
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
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
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
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
Oct 5, 2010
I have 2.2 installed and rooted. I want to overclock. I have searched the Internet on how but the guides don't make sense to me. I don't know what .img I should use and I don't understand the adb shell.
View 10 Replies
View Related
Apr 17, 2010
I wanna change APN settings in a phone. Looked the api and there is a content provider named ACTION_APN_SETTINGS developer.android.com/reference/android/provider/Settings.html#ACTION_APN_SETTINGS but I'm having a hard time figuring out how to use it. Is there any example or something that does not involve the "contacts" content provider?
View 1 Replies
View Related
Jun 1, 2010
How can I get and connect to the internet Database of the device so that I can:Obtain the phone number and other carrier information associated with the device? Obtain email settings of the device?Is it possible to change the email settings via an app on the device?
View 2 Replies
View Related
Apr 10, 2010
I am looking for an app to do the following things. Change ringer setting when getting a call from a certain number. i.e. Turn the ringer on when I call it from my google voice number in case I loose it.Also, to run a script when connecting to a specific wifi network.I believe Locale can do at least the first one, but I was wondering if there were any cheaper apps to do this as I have no interest in the gps features of locale.
View 1 Replies
View Related
Nov 4, 2009
I want to know if there is a way to change the phone number in Settings> About Phone > Status. It's strange - I've only had the phone a few days, got one at the same time as my wife. For some reason the Phone number according to my device is my wife's number although it definitely has my SIM card in the slot and is functioning with the right number. Whereas my wife's device reads unknown in this field. How can I change it to my number?
View 3 Replies
View Related
Jul 6, 2010
Does anyone know of an app to change vital phone settings based on your location? So, if i'm at home, my WiFi will turn on, same for my friends. Or i get to work and it turns to silent?
View 13 Replies
View Related
Jan 3, 2010
I couldn't find any threads on this topic but im sure its been asked so sorry in advance. Is there anyway to change my settings on my HERO to work on 3G for AT T network? or is it a hardware issue that im stuck with? then again i hear EDGE is about the same in terms of speed?
View 2 Replies
View Related
May 4, 2012
I want to know how can i change the phone info, in the system settings.
I want to change them for my own rom, so i want to include, for example, a different build date, build number, kernel version, etc..
View 1 Replies
View Related
Sep 11, 2010
Any way to change the font not just for my sms but for whole settings and everything?
View 2 Replies
View Related
Jun 6, 2010
As above, never really noticed till today as my phone is normally close by, but it doesn't ring for very long.Is there any way to change it so the phone rings longer?
View 2 Replies
View Related
Aug 5, 2010
Currently my phone rings twice and then go straight to voicemail. How do i change the settings so the phone rings more times before going to voicemail?
View 4 Replies
View Related
Mar 25, 2009
I would like to perform a task just before the phone is shut down. I thought that Application#onTerminate would be called but that does not seem to be the case. Is there a broadcast intent when the phone is going to shutdown? If not, how to run a task just before the phone is turned off?
View 4 Replies
View Related
Nov 10, 2010
I bought a new original shell to change for my old one which have scratches. Now I realize I need some special screwdrivers to release the phone from the shell.
I don't have to mention what I think of this madness but does anyone know what types of screwdrivers I need or will I really have to send it in for service?
View 1 Replies
View Related
Jul 11, 2010
My week old phone seems to randomly select contacts and deletes them from my phone. I have to then log onto the website and go into the synchronisation page and rummage around in the contacts trash to restore them and then re-sync..
I have the Google Sync selected within the Data Synchornisation settings but I have auto synchronisation turned off.
Do I need to change my sync settings or is there a problem?
View 1 Replies
View Related
Mar 14, 2012
Problem: I have one app that let's you lock the device using Device Administration. One of my users had some conflicts with my app and another. He then removed Device Administration and uninstalled my app, rebooted his phone, and now he cannot access his phone.
He of course cannot use my app to change the password now (since it's uninstalled).
His phone is stock 2.2 LG Optimus V, Virgin Mobile, Rooted.
Question:I'm needing to find a way that my user can now change his lock code.
I need:
1.) to know an internal class (from com.android.internal) that I could use within an app to change the lock code (just like the system settings do).
2.) to know a command I can use with adb shell to remove or change the phone lock code.
3.) to know the location of the file that stores the lock code information.
View 1 Replies
View Related
Apr 24, 2010
What is the best way or app to sync my existing Google tasks to my phone?
View 2 Replies
View Related
Jul 16, 2010
Maybe I am misunderstanding something but I believe Android is supposed to automatically kill "unused" tasks after a while. Is that correct? I own a Galaxy S and I see that I still have in the running tasks list some apps that I haven't used for more than 18 hours. And these taks do not make any kind of auto sync, they communicate with the network only when used actively. Am I misunderstanding something?
View 5 Replies
View Related
Dec 8, 2013
I would like to be able to synchronize Contacts, Tasks, Calendars, and Texts between my PC and my Andoid phone. I would like to do this without using Google, since Google stores the stuff on their servers.
At the moment, my email resides on a server we own in a NOC.
I use Thunderbird with Lightning on my PC which gives me email, tasks, calendar, and contacts in one interface.
I then use MyPhoneExplorer to Sync with my Android. This gives me tasks, calendar, and contacts synchronized, but all in separate interfaces and then I've got K-9 for email which is again separate.
What I'd like is an email client that included tasks, calendar, and integrated properly with contacts on both my PC and my Android.
I'm willing to use pretty much any software on the PC and on the Android, but I've found nothing that does this cleanly.
My tasks are email centric, meaning that I create tasks out of emails because that's how I get work requests.
I'm willing to use any combination of apps on my PC and on my Android, but the ideal solution would be one applications for all of it which integrated nicely with the Android phone contact list.
View 1 Replies
View Related
Oct 26, 2011
is it possible to send sms via adb shell from pc to android phone (via usb) ??
View 4 Replies
View Related
Feb 24, 2009
I'm developing an application that change System APN. but I don't have any information to do that. Does anyone know how to change APN Settings
View 3 Replies
View Related
Nov 24, 2009
I love how my phone syncs with Google Calendar, but how do I view and use/sync my Tasks list (to do List) from Google Calendar, do I need an app for that?
View 10 Replies
View Related