How do you write this simple app?

zaza

Member
Feb 11, 2015
130
1
0
I'm trying to use an app from the playstore called DroidScript, it helps write simple apps.

I want to make a simple app that makes a tiny edit in a system file. I just want it to print a word into the below file, but I still have no idea how

/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor

(Naturally this app should also request superuser priveleges, which I also have no idea how to write)
 

paperwastage

Golden Member
May 25, 2010
1,848
2
76
Runtime.getRuntime().exec("su -c \" echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor \"");

for native java code

it says that DroidScript can import java package... so try to import the Runtime java class
 
Last edited:

zaza

Member
Feb 11, 2015
130
1
0
Sorry I'm completely clueless, I'm still new to programming.

This is the sample code I want to use:
Code:
//Called when application is started.
function OnStart()
{


    //Force app to Portrait mode.
    app.SetOrientation("Portrait");

    //Create a layout with objects vertically centered.
    lay = app.CreateLayout("linear","VCenter,FillXY");

    //Create a toggle button.
    tgl = app.CreateToggle("Toggle Button",0.4);
    tgl.SetMargins(0,0.02,0,0);
    tgl.SetOnTouch(tgl_OnTouch);
    lay.AddChild(tgl);

    //Add layout to app.
    app.AddLayout(lay);
}


//Called when user touches our toggle button.
function tgl_OnTouch(isChecked)
{
    app.ShowPopup("Checked = " + isChecked);
}

So, what do I do here to get superuser permission for the app?
 
Last edited: