We'd like to remind Forumites to please avoid political debate on the Forum. This is to keep it a safe and useful space for MoneySaving discussions. Threads that are - or become - political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

query; Shell script in Android

Hi, I'm hoping someone might be able to help out please with an android query. :)

I'd like to write a simple batch file or script for android, in this case to access the global system settings and to toggle the "Data Enabled" setting, and possibly to toggle on Roaming data plus the background sync too.
And finally, to run 3G Watchdog (or some similar app).

Then either a similar script to set all values back to false, or possibly using a simple if-condition to toggle all values back to false once the script is run a second time (unfortunately I understand you can no longer close an app through script).


I'm guessing I would have to use something like GScript to execute the scripts (I would keep a shortcut to each script on the homescreen), but the syntax is totally foreign to me so I'm having to work from examples.. :(

I can find enough examples out there to work out how to run a given app, but the syntax to modify system settings is what is proving trickier..

If anyone is able to help I'd be most grateful - Cheers! :)

Comments

  • OneADay
    OneADay Posts: 9,031 Forumite
    1,000 Posts Combo Breaker
    Probably need to use Perl with this http://code.google.com/p/android-scripting/
    There is also the Android SDK - if you really wanted to learn.
  • nickmack
    nickmack Posts: 4,435 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    I'd like to write a simple batch file or script for android, in this case to access the global system settings and to toggle the "Data Enabled" setting, and possibly to toggle on Roaming data plus the background sync too.
    And finally, to run 3G Watchdog (or some similar app).

    Then either a similar script to set all values back to false, or possibly using a simple if-condition to toggle all values back to false once the script is run a second time (unfortunately I understand you can no longer close an app through script).

    I use Tasker which can do this and a whole lot more tasks by reacting to various triggers/conditions. It has it's own simple scripting. You could automatically set data off when you're at home by using network location or GPS and turn your WiFi on for example.

    It's a paid for app in the Android Market, but IMO it's worth every penny. I don't have any affiliation with this app other than being a very satisfied user who automates pretty much everything on my device using it!
  • OneADay wrote: »
    Probably need to use Perl with this http://code.google.com/p/android-scripting/
    There is also the Android SDK - if you really wanted to learn.


    Cheers OAD, you know, I think I do want to learn. :)
    I used to spend a fair bit of time in VB, and later a variant of java - hobby level computer games & windows tools, but nothing more serious.
    But I'd love to be up to speed with android, have the chance to set up a dev machine & really plow some time into it like I used to be able to.. [/wistful voice] :o

    @nickmack; What I'm trying to achieve is a single shortcut which I can click to enable data, roaming (I'm on T-Mob so I roam on Orange) plus 3gW, which I would activate immediately before using the internet, and one (or a toggle) to deactivate them all.

    I've tried Tasker, but to achieve the above you need to also have APNDroid installed, making 2 apps running just to perform one job which the OS can handle natively with a console command or 2 (and so, a script).

    Not to knock Tasker though - I still have it installed & reading up on it again, I can see a way to finally realise my plan of a motorbike-mounted phone (using an old knackered OSF I have spare) which can use contexts to detect when it's being stolen, alert me, and keep logs of it's position to help you if you're getting intermittent gps coverage.
    But that's for another day.. :p
This discussion has been closed.
Meet your Ambassadors

Categories

  • All Categories
  • 347.8K Banking & Borrowing
  • 251.9K Reduce Debt & Boost Income
  • 452.2K Spending & Discounts
  • 240.1K Work, Benefits & Business
  • 616.3K Mortgages, Homes & Bills
  • 175.4K Life & Family
  • 253.5K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 15.1K Coronavirus Support Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.