title: How to make your android app ask for superuser access only once?
body: <p>I'm creating my first android app which is changing your MAC address and the device hostname. However, I want to only have to request for superuser access once.</p>
  
  <p>This is how I'm currently executing my su commands:</p>
  
  <pre><code>String[] cmdHost = { "su", "-c", "/system/bin/setprop net.hostname " + strHostname};
  execute = Runtime.getRuntime().exec(cmdHost);
  </code></pre>
  
  <p>Every time the user presses on the button to change the hostname or the MAC address, it asks for superuser access again.</p>
  
  <p>Is there any way I can solve this? Also, I see that some apps only execute /system/bin/sh in the SuperUser app logs. Mine shows the whole command.</p>
  
  <p>Thank you very much!</p>