Hi! Ive been into rom development for some time but up until now I've only been a modder/themer... I'm trying to create a simple app that can request root privileges and run a sh script for my rom... but im kind of confused... I just need the app to respond to a button click by running the script... here is my code
When I click the button to begin the backup I get force closes.... I don't really have any coding experience so any help would be appreciated
Code:
package com.teamglitch.backup;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class OnAndroidBackupAppActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
/** Called when the user clicks the button */
public void startBackup(View view) {
// Do something in response to button
Intent intent = new Intent(this, beginbackup.class);
startActivity(intent);
}
}
Code:
/**
*
*/
package com.teamglitch.backup;
import java.io.IOException;
/**
* @author Josh
*
*/
public class beginbackup {
void backup(String command)
{
java.lang.Process p;
try {
// Perform su to get root privileges
p = Runtime.getRuntime().exec("su");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try{
Runtime.getRuntime().exec("/system/bin/sh /system/bin/onandroid.sh");
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();}
}
}
When I click the button to begin the backup I get force closes.... I don't really have any coding experience so any help would be appreciated